Use <version> to determine standard library

This commit is contained in:
Nikita Kniazev
2019-12-03 19:35:14 +03:00
parent 8aa8d541b3
commit 26f20bd8e5

View File

@ -11,10 +11,21 @@
// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: // locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed:
// First include <cstddef> to determine if some version of STLport is in use as the std lib // First, check if __has_include is available and <version> include can be located,
// otherwise include <cstddef> to determine if some version of STLport is in use as the std lib
// (do not rely on this header being included since users can short-circuit this header // (do not rely on this header being included since users can short-circuit this header
// if they know whose std lib they are using.) // if they know whose std lib they are using.)
#ifdef __cplusplus #if defined(__cplusplus) && defined(__has_include)
# if __has_include(<version>)
// It should be safe to include `<version>` when it is present without checking
// the actual C++ language version as it consists solely of macro definitions.
// [version.syn] p1: The header <version> supplies implementation-dependent
// information about the C++ standard library (e.g., version number and release date).
# include <version>
# else
# include <cstddef>
# endif
#elif defined(__cplusplus)
# include <cstddef> # include <cstddef>
#else #else
# include <stddef.h> # include <stddef.h>