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,19 +28,22 @@
// don't warn about function style casts in byte related operators
#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
#if _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE)
#if _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE)
#define GSL_USE_STD_BYTE 1
#else // _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE)
#else // _MSC_VER >= 1911 && (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE)
#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
#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
#if defined(__cplusplus) && (__cplusplus >= 201703L)
@ -52,6 +55,7 @@
#define GSL_USE_STD_BYTE 0
#endif //defined(__cplusplus) && (__cplusplus >= 201703L)
#endif // GSL_USE_STD_BYTE
#endif // _MSC_VER