From 97dc8f83fca1c5d038579ed1f26016a52b3aaf8b Mon Sep 17 00:00:00 2001 From: Jordan Maples Date: Thu, 24 Oct 2019 17:07:42 -0700 Subject: [PATCH 1/2] adding check to __cpp_lib_byte, which was added to the defn for 15.8 --- include/gsl/gsl_byte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/gsl/gsl_byte b/include/gsl/gsl_byte index 1670646..7939ff8 100644 --- a/include/gsl/gsl_byte +++ b/include/gsl/gsl_byte @@ -33,6 +33,8 @@ #include +// VS2017 15.8 added support for the __cpp_lib_byte definition +// TODO: drop _HAS_STD_BYTE when support for pre 15.8 expires #ifdef _MSC_VER #pragma warning(push) @@ -42,15 +44,15 @@ #ifndef GSL_USE_STD_BYTE // this tests if we are under MSVC and the standard lib has std::byte and it is enabled -#if defined(_HAS_STD_BYTE) && _HAS_STD_BYTE +#if (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603) #define GSL_USE_STD_BYTE 1 -#else // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE +#else // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE || (defined(__cpp_lib_byte) && __cpp_lib_byte) #define GSL_USE_STD_BYTE 0 -#endif // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE +#endif // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE || (defined(__cpp_lib_byte) && __cpp_lib_byte) #endif // GSL_USE_STD_BYTE #else // _MSC_VER From 22cba52114afa8b5809cffd0d7925eebf7170a33 Mon Sep 17 00:00:00 2001 From: Jordan Maples Date: Fri, 25 Oct 2019 10:12:41 -0700 Subject: [PATCH 2/2] update comments --- include/gsl/gsl_byte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gsl/gsl_byte b/include/gsl/gsl_byte index 7939ff8..c2fc572 100644 --- a/include/gsl/gsl_byte +++ b/include/gsl/gsl_byte @@ -34,7 +34,7 @@ #include // VS2017 15.8 added support for the __cpp_lib_byte definition -// TODO: drop _HAS_STD_BYTE when support for pre 15.8 expires +// To do: drop _HAS_STD_BYTE when support for pre 15.8 expires #ifdef _MSC_VER #pragma warning(push) @@ -48,11 +48,11 @@ #define GSL_USE_STD_BYTE 1 -#else // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE || (defined(__cpp_lib_byte) && __cpp_lib_byte) +#else // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603) #define GSL_USE_STD_BYTE 0 -#endif // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE || (defined(__cpp_lib_byte) && __cpp_lib_byte) +#endif // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603) #endif // GSL_USE_STD_BYTE #else // _MSC_VER