#pragma once #include namespace sp { /// @brief Default case, see field_index specialization for implementation details template typename U, typename = void> static constexpr size_t field_index = 0; /// @brief A templated size_t that counts the number of existing classes U with a "field_name" member /// @tparam N Current counter for recursion (user should always call it with 0) /// @tparam T Can be any type, must be different for each field we want to be counted later (used because we can't have a empty /// template<> specialization nested in a class) /// @tparam U The templated class that will be searched for match template typename U> static constexpr size_t field_index::field_name)>> = 1 + field_index; /// @brief Concat multiple tuples in one big tuple /// @tparam ...input_t Multiple std::tuple types to concat template using tuple_cat_t = decltype(std::tuple_cat(std::declval()...)); template constexpr bool tuple_contains_type = false; template constexpr bool tuple_contains_type> = std::disjunction_v...>; template constexpr int get_tuple_index = 0; template constexpr int get_tuple_index> = 0; template constexpr int get_tuple_index> = 1 + get_tuple_index>; } // namespace sp