Skip to content

Commit b86d207

Browse files
committed
Remove boilerplate from rfl::internal::move_to_field_tuple
1 parent 0a86ff3 commit b86d207

File tree

2 files changed

+3
-1984
lines changed

2 files changed

+3
-1984
lines changed

include/rfl/internal/move_to_field_tuple.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#include <type_traits>
66

77
#include "rfl/field_names_t.hpp"
8+
#include "rfl/internal/bind_to_tuple.hpp"
89
#include "rfl/internal/flattened_ptr_tuple_t.hpp"
910
#include "rfl/internal/has_fields.hpp"
1011
#include "rfl/internal/is_flatten_field.hpp"
1112
#include "rfl/internal/is_named_tuple.hpp"
1213
#include "rfl/internal/lit_name.hpp"
13-
#include "rfl/internal/move_to_field_tuple_impl.hpp"
1414

1515
namespace rfl {
1616
namespace internal {
@@ -21,7 +21,6 @@ auto wrap_in_fields(auto&& _tuple, Fields&&... _fields) {
2121
constexpr auto i = sizeof...(_fields);
2222
if constexpr (i == size) {
2323
return std::make_tuple(std::move(_fields)...);
24-
2524
} else {
2625
auto value = std::move(std::get<i>(_tuple));
2726
using Type = std::decay_t<decltype(value)>;
@@ -49,10 +48,10 @@ auto move_to_field_tuple(OriginalStruct&& _t) {
4948
if constexpr (internal::is_named_tuple_v<T>) {
5049
return _t.fields();
5150
} else if constexpr (has_fields<T>()) {
52-
return move_to_field_tuple_impl(std::move(_t));
51+
return bind_to_tuple(_t, [](auto& x) { return std::move(x); });
5352
} else {
5453
using FieldNames = field_names_t<T>;
55-
auto tup = move_to_field_tuple_impl(std::move(_t));
54+
auto tup = bind_to_tuple(_t, [](auto& x) { return std::move(x); });
5655
return wrap_in_fields<FieldNames>(std::move(tup));
5756
}
5857
}

0 commit comments

Comments
 (0)