draconisplusplus/include/rfl/Processors.hpp

39 lines
913 B
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifndef RFL_INTERNAL_PROCESSORS_HPP_
#define RFL_INTERNAL_PROCESSORS_HPP_
#include <type_traits>
#include "internal/is_no_optionals_v.hpp"
namespace rfl {
2024-06-08 14:10:59 -04:00
template <class... Ps>
struct Processors;
template <>
struct Processors<> {
static constexpr bool all_required_ = false;
template <class T, class NamedTupleType>
static auto process(NamedTupleType&& _named_tuple) {
return _named_tuple;
}
};
template <class Head, class... Tail>
struct Processors<Head, Tail...> {
2024-06-16 00:13:15 -04:00
static constexpr bool all_required_ =
std::disjunction_v<internal::is_no_optionals<Head>, internal::is_no_optionals<Tail>...>;
2024-06-08 14:10:59 -04:00
template <class T, class NamedTupleType>
static auto process(NamedTupleType&& _named_tuple) {
return Processors<Tail...>::template process<T>(
2024-06-16 00:13:15 -04:00
Head::template process<T>(std::move(_named_tuple))
2024-06-08 15:53:06 -04:00
);
2024-06-08 14:10:59 -04:00
}
};
} // namespace rfl
2024-05-31 22:59:00 -04:00
#endif