Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Sep 11, 2024
1 parent d145180 commit 264e66f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/ylt/reflection/member_names.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ inline constexpr bool has_alias_struct_name_v =
has_alias_struct_names_t<T>::value;

template <typename T, typename U, size_t... Is>
inline constexpr void init_arr_with_tuple(const T& tp, U& arr,
std::index_sequence<Is...>) {
inline constexpr void init_arr_with_tuple(U& arr, std::index_sequence<Is...>) {
constexpr auto tp = struct_to_tuple<T>();
((arr[Is] = internal::get_member_name<internal::wrap(std::get<Is>(tp))>()),
...);
}
Expand All @@ -106,18 +106,17 @@ get_member_names() {
return type::refl_member_names(ylt::reflection::identity<type>{});
}
else {
constexpr auto tp = struct_to_tuple<T>();

std::array<std::string_view, Count> arr;
#if __cplusplus >= 202002L
constexpr auto tp = struct_to_tuple<T>();
[&]<size_t... Is>(std::index_sequence<Is...>) mutable {
((arr[Is] =
internal::get_member_name<internal::wrap(std::get<Is>(tp))>()),
...);
}
(std::make_index_sequence<Count>{});
#else
init_arr_with_tuple(tp, arr, std::make_index_sequence<Count>{});
init_arr_with_tuple<T>(arr, std::make_index_sequence<Count>{});
#endif
return arr;
}
Expand Down

0 comments on commit 264e66f

Please sign in to comment.