From 2b8d20425e990c5a3e9a0158e2cedacbcdf9e522 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Mon, 24 Jul 2017 17:26:21 -0700 Subject: [PATCH] Allow users to override GSL_USE_STD_BYTE (#536) --- include/gsl/gsl_byte | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/gsl/gsl_byte b/include/gsl/gsl_byte index 7f694d5..1e2e3be 100644 --- a/include/gsl/gsl_byte +++ b/include/gsl/gsl_byte @@ -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