|
Boost : |
Subject: Re: [boost] Where we are 1.65.0
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2017-08-09 20:23:00
[John Maddock]
> I wonder if we should have a blanket check for C++17 in suffix.hpp which would
> then set these macros regardless of compiler if it claims to be in
> C++17 mode? That won't help with VC++ which hasn't updated __cplusplus
> in a while, but would have avoided the clang issue...
_MSVC_LANG indicates whether /std:c++14, /std:c++17, or /std:c++latest is being used. You can test it like this:
#ifndef YOUR_CXX17_MACRO
#ifdef _MSVC_LANG
#if _MSVC_LANG > 201402
#define YOUR_CXX17_MACRO 1
#else
#define YOUR_CXX17_MACRO 0
#endif
#else
#if __cplusplus > 201402
#define YOUR_CXX17_MACRO 1
#else
#define YOUR_CXX17_MACRO 0
#endif
#endif
#endif
Alternatively, instead of asking the compiler, you can ask our STL whether it's in C++17 mode. Simply include any header (good old <ciso646> will do) and _HAS_CXX17 will be defined to either 0 or 1.
Thanks,
STL
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk