|
#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 |
|
|
|
#define GSL_USE_STD_BYTE 1 |
|
|
|
#else // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE |
|
|
|
#define GSL_USE_STD_BYTE 0 |
|
|
|
#endif // defined(_HAS_STD_BYTE) && _HAS_STD_BYTE |
|
#endif // GSL_USE_STD_BYTE |
inspects an implementation-specific macro _HAS_STD_BYTE defined by MSVC's STL:
https://github.com/microsoft/STL/blob/447f879b136950baf3ca35dfb54c359494fa2a77/stl/inc/yvals_core.h#L475-L477
instead of the Standard feature-test macro __cpp_lib_byte:
https://github.com/microsoft/STL/blob/447f879b136950baf3ca35dfb54c359494fa2a77/stl/inc/yvals_core.h#L888-L890
GSL could inspect both, which would make it compatible with:
- VS 2017 15.3 (which added
std::byte and _HAS_STD_BYTE) through 15.7
- VS 2017 15.8 (which added
__cpp_lib_byte) through VS 2019 today
- Future versions of VS (when GSL stops inspecting
_HAS_STD_BYTE alone, VS can stop defining it).
GSL/include/gsl/gsl_byte
Lines 43 to 54 in 3d56ba9
inspects an implementation-specific macro
_HAS_STD_BYTEdefined by MSVC's STL:https://github.com/microsoft/STL/blob/447f879b136950baf3ca35dfb54c359494fa2a77/stl/inc/yvals_core.h#L475-L477
instead of the Standard feature-test macro
__cpp_lib_byte:https://github.com/microsoft/STL/blob/447f879b136950baf3ca35dfb54c359494fa2a77/stl/inc/yvals_core.h#L888-L890
GSL could inspect both, which would make it compatible with:
std::byteand_HAS_STD_BYTE) through 15.7__cpp_lib_byte) through VS 2019 today_HAS_STD_BYTEalone, VS can stop defining it).