fktn-k / fkYAML

A C++ header-only YAML library
MIT License
67 stars 7 forks source link

Use _MSVC_LANG macro when compiled with MSVC for C++ standard detection #392

Closed fktn-k closed 1 month ago

fktn-k commented 1 month ago

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

github-actions[bot] commented 1 month ago

:octocat: Upload Coverage Event Notification

Coverage data has been uploaded for the commit 25bb0a2ac28342a21871af2f9940901164ec89cf. You can download the artifact which contains the same file uploaded to the Coveralls and its HTML version.

Name fkYAML_coverage.pr392.zip
ID 1905378319
URL https://github.com/fktn-k/fkYAML/actions/runs/10756731601/artifacts/1905378319