adding check to __cpp_lib_byte, which was added to the defn for 15.8

This commit is contained in:
Jordan Maples 2019-10-24 17:07:42 -07:00
parent 71ec9f84d8
commit 97dc8f83fc

View File

@ -33,6 +33,8 @@
#include <type_traits> #include <type_traits>
// 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 #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
@ -42,15 +44,15 @@
#ifndef GSL_USE_STD_BYTE #ifndef GSL_USE_STD_BYTE
// this tests if we are under MSVC and the standard lib has std::byte and it is enabled // 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 #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 #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 #endif // GSL_USE_STD_BYTE
#else // _MSC_VER #else // _MSC_VER