draconisplusplus/include/rfl/internal/all_fields.hpp

27 lines
557 B
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifndef RFL_INTERNAL_ALLFIELDS_HPP_
#define RFL_INTERNAL_ALLFIELDS_HPP_
#include <tuple>
#include <type_traits>
#include <utility>
#include "is_field.hpp"
namespace rfl {
2024-06-08 14:10:59 -04:00
namespace internal {
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
template <class TupleType, int _i = 0>
constexpr bool all_fields() {
if constexpr (_i == std::tuple_size_v<TupleType>) {
2024-05-31 22:59:00 -04:00
return true;
2024-06-08 14:10:59 -04:00
} else {
2024-05-31 22:59:00 -04:00
using T = std::tuple_element_t<_i, TupleType>;
return is_field_v<T> && all_fields<TupleType, _i + 1>();
2024-06-08 14:10:59 -04:00
}
2024-05-31 22:59:00 -04:00
}
2024-06-08 14:10:59 -04:00
} // namespace internal
} // namespace rfl
2024-05-31 22:59:00 -04:00
#endif