Skip to content

Commit

Permalink
Merge pull request #822 from JordanMaples/dev/jomaples/lib-byte-check
Browse files Browse the repository at this point in the history
gsl_byte to inspect __cpp_lib_byte
  • Loading branch information
JordanMaples authored Oct 25, 2019
2 parents 3d56ba9 + 22cba52 commit 9939d58
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/gsl/gsl_byte
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#include <type_traits>

// VS2017 15.8 added support for the __cpp_lib_byte definition
// To do: drop _HAS_STD_BYTE when support for pre 15.8 expires
#ifdef _MSC_VER

#pragma warning(push)
Expand All @@ -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 >= 201603)

#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 >= 201603)
#endif // GSL_USE_STD_BYTE

#else // _MSC_VER
Expand Down

0 comments on commit 9939d58

Please sign in to comment.