Use _MSVC_LANG macro when compiled with MSVC for C++ standard detection #392
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Although this library depends on C++11 by default, some implementations are switched based on the value of the
__cplusplus
macro to utilize some nice-to-have features available since C++14 or better.However, the MSVC compilers don't set an appropriate value to that macro if the
/Zc:__cplusplus
option isn't specified.That issue forces those who use this library with some MSVC compiler to stick to C++11 features even if they explicitly use C++14 or better by specifying options like
/std:c++14
.As explicitly described here, the
_MSVC_LANG
macro is always set a correct value.So, as many other C++ libraries do, this library refers to
_MSVC_LANG
if some MSVC compiler is used to compile, and now detects a correct C++ standard.The updated behavior is tested in my local environment (Windows10, Visual Studio 2019).
Pull Request Checklist
Read the CONTRIBUTING.md file for detailed information.
Please don't
#ifdef
s or other means.