Skip to content

Commit 9939d58

Browse files
authored
Merge pull request #822 from JordanMaples/dev/jomaples/lib-byte-check
gsl_byte to inspect __cpp_lib_byte
2 parents 3d56ba9 + 22cba52 commit 9939d58

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/gsl/gsl_byte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
#include <type_traits>
3535

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

3840
#pragma warning(push)
@@ -42,15 +44,15 @@
4244

4345
#ifndef GSL_USE_STD_BYTE
4446
// this tests if we are under MSVC and the standard lib has std::byte and it is enabled
45-
#if defined(_HAS_STD_BYTE) && _HAS_STD_BYTE
47+
#if (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
4648

4749
#define GSL_USE_STD_BYTE 1
4850

49-
#else // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE
51+
#else // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
5052

5153
#define GSL_USE_STD_BYTE 0
5254

53-
#endif // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE
55+
#endif // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
5456
#endif // GSL_USE_STD_BYTE
5557

5658
#else // _MSC_VER

0 commit comments

Comments
 (0)