diff --git a/src/entt/core/type_traits.hpp b/src/entt/core/type_traits.hpp index d71376175..96421482a 100644 --- a/src/entt/core/type_traits.hpp +++ b/src/entt/core/type_traits.hpp @@ -119,12 +119,49 @@ template constexpr type_list operator+(type_list, type_list) { return {}; } +/*! @brief Primary template isn't defined on purpose. */ +template +struct type_list_cat; + + +/*! @brief Concatenates multiple type lists. */ +template<> +struct type_list_cat<> { + /*! @brief A type list composed by the types of all the type lists. */ + using type = type_list<>; +}; + + +/** + * @brief Concatenates multiple type lists. + * @tparam Type Types provided by the first type list. + * @tparam Other Types provided by the second type list. + * @tparam List Other type lists, if any. + */ +template +struct type_list_cat, type_list, List...> { + /*! @brief A type list composed by the types of all the type lists. */ + using type = typename type_list_cat, List...>::type; +}; + + +/** + * @brief Concatenates multiple type lists. + * @tparam Type Types provided by the type list. + */ +template +struct type_list_cat> { + /*! @brief A type list composed by the types of all the type lists. */ + using type = type_list; +}; + + /** * @brief Helper type. * @tparam List Type lists to concatenate. */ template -using type_list_cat_t = decltype((type_list<>{} + ... + List{})); +using type_list_cat_t = typename type_list_cat::type; /*! @brief Primary template isn't defined on purpose. */