diff --git a/include/etl/type_list.h b/include/etl/type_list.h index afc158f4..6f357b84 100644 --- a/include/etl/type_list.h +++ b/include/etl/type_list.h @@ -79,6 +79,7 @@ namespace etl private: + // A type_list cannot be instantiated, so delete the constructor and assignment operators. type_list() ETL_DELETE; type_list(const type_list&) ETL_DELETE; type_list& operator =(const type_list&) ETL_DELETE; @@ -109,6 +110,7 @@ namespace etl private: + // A type_list cannot be instantiated, so delete the constructor and assignment operators. type_list() ETL_DELETE; type_list(const type_list&) ETL_DELETE; type_list& operator =(const type_list&) ETL_DELETE; @@ -418,10 +420,10 @@ namespace etl private: ETL_STATIC_ASSERT((etl::is_type_list::value), "TTypeList must be an etl::type_list"); - ETL_STATIC_ASSERT(Index <= etl::TTypeList::size, "Index out of range"); + ETL_STATIC_ASSERT(Index <= TTypeList::size, "Index out of range"); using index_sequence_for_prefix = etl::make_index_sequence; - using index_sequence_for_suffix = etl::make_index_sequence_with_offset; + using index_sequence_for_suffix = etl::make_index_sequence_with_offset; using prefix = etl::type_list_select_from_index_sequence_t; using suffix = etl::type_list_select_from_index_sequence_t; @@ -437,6 +439,173 @@ namespace etl using type_list_insert_t = typename etl::type_list_insert::type; #endif + //*************************************************************************** + /// Remove a type at an index in a type_list. + //*************************************************************************** + template + struct type_list_remove + { + private: + + ETL_STATIC_ASSERT((etl::is_type_list::value), "TTypeList must be an etl::type_list"); + ETL_STATIC_ASSERT(Index < TTypeList::size, "Index out of range"); + + using index_sequence_for_prefix = etl::make_index_sequence; + using index_sequence_for_suffix = etl::make_index_sequence_with_offset; + + using prefix = etl::type_list_select_from_index_sequence_t; + using suffix = etl::type_list_select_from_index_sequence_t; + + public: + + // Concatenate the prefix and suffix to create the new type list with the Index element removed. + using type = etl::type_list_cat_t; + }; + +#if ETL_USING_CPP11 + template + using type_list_remove_t = typename etl::type_list_remove::type; +#endif + + //*************************************************************************** + // Remove types that satisfy a predicate from a type_list. + //*************************************************************************** + namespace private_type_list + { + template class TPredicate> + struct type_list_remove_if_impl; + + template