Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions include/rfl/internal/copy_flattened_tuple_to_named_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,15 @@

namespace rfl::internal {

template <class FieldNames, int _i>
auto copy_one_element(const auto& _flattened_tuple) {
const auto name_literal = FieldNames::template name_of<_i>();
return rfl::make_field<
lit_name_v<std::remove_cvref_t<decltype(name_literal)>>>(
std::get<_i>(_flattened_tuple));
}

template <class FieldNames, class... Fields>
auto copy_flattened_tuple_to_named_tuple(const auto& _flattened_tuple) {
constexpr auto size =
rfl::tuple_size_v<std::remove_cvref_t<decltype(_flattened_tuple)>>;
return [&]<int... _i>(std::integer_sequence<int, _i...>) {
return make_named_tuple(
copy_one_element<FieldNames, _i>(_flattened_tuple)...);
rfl::make_field<lit_name_v<
std::remove_cvref_t<decltype(FieldNames::template name_of<_i>())>>>(
std::get<_i>(_flattened_tuple))...);
}(std::make_integer_sequence<int, size>());
}

Expand Down
Loading
Loading