#ifndef RFL_INTERNAL_TO_PTR_FIELD_TUPLE_HPP_ #define RFL_INTERNAL_TO_PTR_FIELD_TUPLE_HPP_ #include #include #include #include "../field_names_t.hpp" #include "bind_to_tuple.hpp" #include "has_fields.hpp" #include "is_empty.hpp" #include "is_named_tuple.hpp" #include "nt_to_ptr_named_tuple.hpp" #include "to_ptr_field.hpp" #include "wrap_in_fields.hpp" namespace rfl { namespace internal { template auto to_ptr_field_tuple(T& _t) { if constexpr (std::is_pointer_v>) { return to_ptr_field_tuple(*_t); } else if constexpr (is_named_tuple_v) { return nt_to_ptr_named_tuple(_t).fields(); } else if constexpr (has_fields()) { return bind_to_tuple(_t, [](auto& x) { return to_ptr_field(x); }); } else if constexpr (is_empty()) { return std::tuple(); } else { using FieldNames = field_names_t; auto tup = bind_to_tuple(_t, [](auto& x) { return to_ptr_field(x); }); return wrap_in_fields(std::move(tup)); } } } // namespace internal } // namespace rfl #endif