Skip to content

Commit

Permalink
[struct_json] is compatible with msvc versions (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
RAVER0306 authored Oct 10, 2024
1 parent a50c1a0 commit 6baa7db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/ylt/reflection/member_names.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ get_member_names() {
}
else {
std::array<std::string_view, Count> arr;
#if __cplusplus >= 202002L
#if __cplusplus >= 202002L && (!defined(_MSC_VER) || _MSC_VER >= 1930)
constexpr auto tp = struct_to_tuple<T>();
[&]<size_t... Is>(std::index_sequence<Is...>) mutable {
((arr[Is] =
Expand Down
4 changes: 2 additions & 2 deletions include/ylt/reflection/member_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ inline constexpr void for_each(T&& t, Visit&& func) {
else {
if constexpr (std::is_invocable_v<Visit, first_t, std::string_view>) {
visit_members(t, [&](auto&... args) {
#if __cplusplus >= 202002L
#if __cplusplus >= 202002L && (!defined(_MSC_VER) || _MSC_VER >= 1930)
[&]<size_t... Is>(std::index_sequence<Is...>) mutable {
constexpr auto arr = get_member_names<T>();
(func(args, arr[Is]), ...);
Expand All @@ -231,7 +231,7 @@ inline constexpr void for_each(T&& t, Visit&& func) {
else if constexpr (std::is_invocable_v<Visit, first_t, std::string_view,
size_t>) {
visit_members(t, [&](auto&... args) {
#if __cplusplus >= 202002L
#if __cplusplus >= 202002L && (!defined(_MSC_VER) || _MSC_VER >= 1930)
[&]<size_t... Is>(std::index_sequence<Is...>) mutable {
constexpr auto arr = get_member_names<T>();
(func(args, arr[Is], Is), ...);
Expand Down

0 comments on commit 6baa7db

Please sign in to comment.