From 6baa7db3d2c1ffea30b863ea6de3663ed7baf1f4 Mon Sep 17 00:00:00 2001 From: raver <39723661+RAVER0306@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:49:50 +0800 Subject: [PATCH] [struct_json] is compatible with msvc versions (#788) --- include/ylt/reflection/member_names.hpp | 2 +- include/ylt/reflection/member_value.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ylt/reflection/member_names.hpp b/include/ylt/reflection/member_names.hpp index cf53e5b3a..285705922 100644 --- a/include/ylt/reflection/member_names.hpp +++ b/include/ylt/reflection/member_names.hpp @@ -126,7 +126,7 @@ get_member_names() { } else { std::array arr; -#if __cplusplus >= 202002L +#if __cplusplus >= 202002L && (!defined(_MSC_VER) || _MSC_VER >= 1930) constexpr auto tp = struct_to_tuple(); [&](std::index_sequence) mutable { ((arr[Is] = diff --git a/include/ylt/reflection/member_value.hpp b/include/ylt/reflection/member_value.hpp index dbdafbabe..afa307a1a 100644 --- a/include/ylt/reflection/member_value.hpp +++ b/include/ylt/reflection/member_value.hpp @@ -215,7 +215,7 @@ inline constexpr void for_each(T&& t, Visit&& func) { else { if constexpr (std::is_invocable_v) { visit_members(t, [&](auto&... args) { -#if __cplusplus >= 202002L +#if __cplusplus >= 202002L && (!defined(_MSC_VER) || _MSC_VER >= 1930) [&](std::index_sequence) mutable { constexpr auto arr = get_member_names(); (func(args, arr[Is]), ...); @@ -231,7 +231,7 @@ inline constexpr void for_each(T&& t, Visit&& func) { else if constexpr (std::is_invocable_v) { visit_members(t, [&](auto&... args) { -#if __cplusplus >= 202002L +#if __cplusplus >= 202002L && (!defined(_MSC_VER) || _MSC_VER >= 1930) [&](std::index_sequence) mutable { constexpr auto arr = get_member_names(); (func(args, arr[Is], Is), ...);