Added basic compile support for MSVC 2013 to byte.

This commit is contained in:
Neil MacIntosh 2016-07-15 17:31:40 -07:00
parent 267472449c
commit 8855c59579
3 changed files with 42 additions and 0 deletions

View File

@ -19,6 +19,23 @@
#ifndef GSL_BYTE_H #ifndef GSL_BYTE_H
#define 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 namespace gsl
{ {
// This is a simple definition for now that allows // This is a simple definition for now that allows
@ -68,4 +85,19 @@ namespace gsl
} // 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 #endif // GSL_BYTE_H

View File

@ -87,6 +87,7 @@ SUITE(byte_tests)
CHECK(a == byte(0x0F)); CHECK(a == byte(0x0F));
} }
} }
} }
int main(int, const char* []) { return UnitTest::RunAllTests(); } int main(int, const char* []) { return UnitTest::RunAllTests(); }

View File

@ -794,6 +794,15 @@ SUITE(span_tests)
CHECK(it1 == it2); CHECK(it1 == it2);
} }
TEST(const_iterator)
{
span<int>::const_iterator it1;
span<int>::const_iterator it2;
CHECK(it1 == it2);
}
TEST(begin_end) TEST(begin_end)
{ {
{ {