-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[struct_json] is compatible with msvc versions #788
Conversation
Code Coverage Report
|
- Merged conditional checks for C++20 support and MSVC version. - Reduced redundancy by combining similar code paths. - Used a unified approach to handle both C++20 compliant compilers and fallback for older MSVC versions. - Ensured that the implementation uses fold expressions and generic lambdas when available, and falls back to visit_members_impl for older environments.
Code Coverage Report
|
This reverts commit 2538348.
Code Coverage Report
|
Code Coverage Report
|
Code Coverage Report
|
Code Coverage Report
|
Code Coverage Report
|
Code Coverage Report
|
The purpose of this change is to ensure compatibility with different versions of the Microsoft Visual Studio (MSVC) compiler. The
_MSC_VER
macro is used to determine the compiler version, allowing the code to handle differences between Visual Studio 2019 (MSVC 14.2x) and Visual Studio 2022 (MSVC 14.30+). This is particularly important because VS2022 introduces full support for C++20 features, while earlier versions require a fallback implementation.What is changing
The code now includes conditional checks for
_MSC_VER
:_MSC_VER >= 1930
(Visual Studio 2022 or newer), the code leverages C++20 features such as generic lambdas and fold expressions._MSC_VER >= 1920 && _MSC_VER < 1930
), the code falls back to an alternative implementation to maintain compatibility.This ensures that the code can be compiled with both VS2019 and VS2022 while taking full advantage of C++20 features where available.
Example
For example, the following macro-based logic ensures that the code behaves correctly in both compilers: