diff --git a/include/rfl/internal/has_n_fields.hpp b/include/rfl/internal/has_n_fields.hpp index a4274fe5..5665a616 100644 --- a/include/rfl/internal/has_n_fields.hpp +++ b/include/rfl/internal/has_n_fields.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace rfl { namespace internal { diff --git a/include/rfl/internal/num_fields.hpp b/include/rfl/internal/num_fields.hpp new file mode 100644 index 00000000..10c47a17 --- /dev/null +++ b/include/rfl/internal/num_fields.hpp @@ -0,0 +1,28 @@ +#ifndef RFL_INTERNAL_NUM_FIELDS_HPP_ +#define RFL_INTERNAL_NUM_FIELDS_HPP_ + +#include + +#include "rfl/internal/has_n_fields.hpp" + +namespace rfl { +namespace internal { + +template +struct num_fields_impl { + static constexpr std::size_t value = num_fields_impl::value; +}; + +template + requires has_n_fields +struct num_fields_impl { + static constexpr std::size_t value = _n; +}; + +template +constexpr std::size_t num_fields = num_fields_impl::value; + +} // namespace internal +} // namespace rfl + +#endif