From 8855c59579bb0de5212210662ed8aebff3582d41 Mon Sep 17 00:00:00 2001 From: Neil MacIntosh Date: Fri, 15 Jul 2016 17:31:40 -0700 Subject: [PATCH] Added basic compile support for MSVC 2013 to byte. --- include/gsl_byte.h | 32 ++++++++++++++++++++++++++++++++ tests/byte_tests.cpp | 1 + tests/span_tests.cpp | 9 +++++++++ 3 files changed, 42 insertions(+) diff --git a/include/gsl_byte.h b/include/gsl_byte.h index 6e32fef..e2c79c9 100644 --- a/include/gsl_byte.h +++ b/include/gsl_byte.h @@ -19,6 +19,23 @@ #ifndef GSL_BYTE_H #define GSL_BYTE_H +#ifdef _MSC_VER + +// MSVC 2013 workarounds +#if _MSC_VER <= 1800 + +// constexpr is not understood +#pragma push_macro("constexpr") +#define constexpr + +// noexcept is not understood +#pragma push_macro("noexcept") +#define noexcept + +#endif // _MSC_VER <= 1800 + +#endif // _MSC_VER + namespace gsl { // This is a simple definition for now that allows @@ -68,4 +85,19 @@ namespace gsl } // namespace gsl + +#ifdef _MSC_VER + +#if _MSC_VER <= 1800 + +#undef constexpr +#pragma pop_macro("constexpr") + +#undef noexcept +#pragma pop_macro("noexcept") + +#endif // _MSC_VER <= 1800 + +#endif // _MSC_VER + #endif // GSL_BYTE_H \ No newline at end of file diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index 19456fd..5d4e7f6 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -87,6 +87,7 @@ SUITE(byte_tests) CHECK(a == byte(0x0F)); } } + } int main(int, const char* []) { return UnitTest::RunAllTests(); } diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 5c17552..ae3c32e 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -794,6 +794,15 @@ SUITE(span_tests) CHECK(it1 == it2); } + TEST(const_iterator) + { + span::const_iterator it1; + span::const_iterator it2; + CHECK(it1 == it2); + + + } + TEST(begin_end) { {