Allow users to override GSL_USE_STD_BYTE (#536)

This commit is contained in:
Casey Carter 2017-07-24 17:26:21 -07:00 committed by Neil MacIntosh
parent be43c79742
commit 2b8d20425e

View File

@ -28,6 +28,7 @@
// don't warn about function style casts in byte related operators // don't warn about function style casts in byte related operators
#pragma warning(disable : 26493) #pragma warning(disable : 26493)
#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 _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE) #if _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE)
@ -38,9 +39,11 @@
#define GSL_USE_STD_BYTE 0 #define GSL_USE_STD_BYTE 0
#endif // _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE) #endif // _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE)
#endif // GSL_USE_STD_BYTE
#else // _MSC_VER #else // _MSC_VER
#ifndef GSL_USE_STD_BYTE
// this tests if we are under GCC or Clang with enough -std:c++1z power to get us std::byte // this tests if we are under GCC or Clang with enough -std:c++1z power to get us std::byte
#if defined(__cplusplus) && (__cplusplus >= 201703L) #if defined(__cplusplus) && (__cplusplus >= 201703L)
@ -52,6 +55,7 @@
#define GSL_USE_STD_BYTE 0 #define GSL_USE_STD_BYTE 0
#endif //defined(__cplusplus) && (__cplusplus >= 201703L) #endif //defined(__cplusplus) && (__cplusplus >= 201703L)
#endif // GSL_USE_STD_BYTE
#endif // _MSC_VER #endif // _MSC_VER