#pragma once #include #include #include #include namespace structive { template struct Type_List {}; template struct Type_List_Contains; template struct Type_List_Contains> : std::bool_constant<(std::same_as || ...)> {}; template inline constexpr bool type_list_contains_v = Type_List_Contains::value; template struct Type_List_Push_Unique; template struct Type_List_Push_Unique, Type> { using type = std::conditional_t<(std::same_as || ...), Type_List, Type_List>; }; template > struct Type_List_Unique; template struct Type_List_Unique, Output> { using type = Output; }; template struct Type_List_Unique, Output> { using next = typename Type_List_Push_Unique::type; using type = typename Type_List_Unique, next>::type; }; template struct Type_List_Index; template struct Type_List_Index> : std::integral_constant {}; template struct Type_List_Index> : std::integral_constant>::value> {}; template inline constexpr std::size_t type_list_index_v = Type_List_Index::value; template struct Attribute_Category_Of { using type = void; }; template struct Attribute_Category_Of> { using type = typename Attribute::attribute_category; }; template using attribute_category_of_t = typename Attribute_Category_Of::type; template struct Find_Attribute_By_Category; template struct Find_Attribute_By_Category { using type = void; }; template struct Find_Attribute_By_Category { using type = std::conditional_t, void> && std::same_as>, Head, typename Find_Attribute_By_Category::type>; }; template struct Find_Attribute_In_List; template struct Find_Attribute_In_List> { using type = typename Find_Attribute_By_Category::type; }; template using find_attribute_in_list_t = typename Find_Attribute_In_List::type; template consteval std::size_t count_attribute_category() { return (std::size_t{0} + ... + (!std::same_as, void> && std::same_as, Category> ? 1u : 0u)); } template consteval bool unique_single_value_category_for() { if constexpr (requires { Attribute::single_valued; }) { if constexpr (Attribute::single_valued && !std::same_as, void>) { return count_attribute_category, Attributes...>() == 1; } } return true; } template consteval bool unique_single_value_categories() { return (unique_single_value_category_for() && ...); } }