feat(reflect-cpp): Switched from glaze -> reflect cpp
A bug was discovered in glaze which prevented valid toml output. We have switched to toml++ and reflect-cpp. The interface has remained the same so this should not break any code
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#ifndef RFL_INTERNAL_TO_FLATTENED_PTR_TUPLE_HPP_
|
||||
#define RFL_INTERNAL_TO_FLATTENED_PTR_TUPLE_HPP_
|
||||
|
||||
#include "../Tuple.hpp"
|
||||
#include "../tuple_cat.hpp"
|
||||
#include "has_flatten_fields.hpp"
|
||||
#include "is_flatten_field.hpp"
|
||||
#include "to_ptr_tuple.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace internal {
|
||||
|
||||
template <class PtrTuple>
|
||||
auto flatten_ptr_tuple(PtrTuple&& _t) {
|
||||
if constexpr (!has_flatten_fields<PtrTuple>()) {
|
||||
return std::forward<PtrTuple>(_t);
|
||||
} else {
|
||||
const auto get_one = [&]<int _i>(std::integral_constant<int, _i>) {
|
||||
using T = tuple_element_t<_i, std::remove_cvref_t<PtrTuple>>;
|
||||
if constexpr (is_flatten_field_v<T>) {
|
||||
return flatten_ptr_tuple(to_ptr_tuple(rfl::get<_i>(_t)->get()));
|
||||
} else {
|
||||
return rfl::make_tuple(rfl::get<_i>(_t));
|
||||
}
|
||||
};
|
||||
|
||||
constexpr auto size = rfl::tuple_size_v<std::remove_cvref_t<PtrTuple>>;
|
||||
|
||||
return [&]<int... _is>(std::integer_sequence<int, _is...>) {
|
||||
return rfl::tuple_cat(get_one(std::integral_constant<int, _is>{})...);
|
||||
}
|
||||
(std::make_integer_sequence<int, size>());
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
auto to_flattened_ptr_tuple(T&& _t) {
|
||||
return flatten_ptr_tuple(to_ptr_tuple(_t));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user