#ifndef RFL_INTERNAL_MOVE_AND_FLATTEN_FIELD_TUPLE_HPP_ #define RFL_INTERNAL_MOVE_AND_FLATTEN_FIELD_TUPLE_HPP_ #include #include "is_flatten_field.hpp" #include "move_to_field_tuple.hpp" namespace rfl { namespace internal { template auto move_and_flatten_field_tuple(FieldTuple&& _t, Args&&... _args) { constexpr auto i = sizeof...(Args); if constexpr (i == std::tuple_size_v>) { return std::tuple_cat(std::move(_args)...); } else { using T = std::tuple_element_t>; if constexpr (is_flatten_field::value) { return move_and_flatten_field_tuple( std::move(_t), std::move(_args)..., move_and_flatten_field_tuple(move_to_field_tuple(std::move(std::get(_t).value_))) ); } else { return move_and_flatten_field_tuple( std::move(_t), std::move(_args)..., std::make_tuple(std::move(std::get(_t))) ); } } } } // namespace internal } // namespace rfl #endif