diff --git a/include/etl/type_list.h b/include/etl/type_list.h index f4607dc9..21ee103c 100644 --- a/include/etl/type_list.h +++ b/include/etl/type_list.h @@ -204,20 +204,20 @@ namespace etl //*************************************************************************** /// Defines a bool constant that is true if the type_list contains the specified type, otherwise false. //*************************************************************************** - template + template struct type_list_contains : public etl::integral_constant::value ? true : type_list_contains::value> { }; - template + template struct type_list_contains, T> : public etl::integral_constant { }; #if ETL_USING_CPP17 - template + template inline constexpr bool type_list_contains_v = etl::type_list_contains::value; #endif @@ -225,30 +225,30 @@ namespace etl /// Defines an integral constant that is the index of the specified type in the type_list. /// If the type is not in the type_list, then defined as etl::type_list_npos. //*************************************************************************** - template - struct type_list_index_of + template + struct type_list_index_of_type : public etl::integral_constant::value ? 0 : - (type_list_index_of::value == etl::type_list_npos ? etl::type_list_npos : - type_list_index_of::value + 1)> + (type_list_index_of_type::value == etl::type_list_npos ? etl::type_list_npos : + type_list_index_of_type::value + 1)> { }; - template - struct type_list_index_of, T> + template + struct type_list_index_of_type, T> : public etl::integral_constant { }; #if ETL_USING_CPP17 - template - inline constexpr size_t type_list_index_of_v = etl::type_list_index_of::value; + template + inline constexpr size_t type_list_index_of_v = etl::type_list_index_of_type::value; #endif //*************************************************************************** /// Defines type as the type found at Index in the type_list. /// Static asserts if Index is out of range. //*************************************************************************** - template + template struct type_list_type_at_index { ETL_STATIC_ASSERT(Index <= type_list_size::value, "etl::type_list_type_at_index out of range"); @@ -256,27 +256,27 @@ namespace etl using type = nth_type_t; }; - template + template using type_list_type_at_index_t = typename type_list_type_at_index::type; //*************************************************************************** /// Defines an integral constant that is maximum sizeof all types in the type_list. /// If the type_list is empty, then defined as 0. //*************************************************************************** - template + template struct type_list_max_sizeof_type : public etl::integral_constant::value)> { }; - template<> + template <> struct type_list_max_sizeof_type> : public etl::integral_constant { }; #if ETL_USING_CPP17 - template + template inline constexpr size_t type_list_max_sizeof_type_v = etl::type_list_max_sizeof_type::value; #endif @@ -284,21 +284,21 @@ namespace etl /// Defines an integral constant that is maximum alignment all types in the type_list. /// If the type_list is empty, then defined as 1. //*************************************************************************** - template + template struct type_list_max_alignment : public etl::integral_constant::value, type_list_max_alignment::value)> { }; - template<> + template <> struct type_list_max_alignment> : public etl::integral_constant { }; #if ETL_USING_CPP17 - template + template inline constexpr size_t type_list_max_alignment_v = etl::type_list_max_alignment::value; #endif } diff --git a/test/test_type_list.cpp b/test/test_type_list.cpp index 49641e6f..75c8f322 100644 --- a/test/test_type_list.cpp +++ b/test/test_type_list.cpp @@ -107,15 +107,15 @@ namespace } //************************************************************************* - TEST(test_type_list_index_of) + TEST(test_type_list_index_of_type) { typedef etl::type_list t1; typedef etl::type_list<> t2; - CHECK_EQUAL((etl::type_list_index_of::value), 0); - CHECK_EQUAL((etl::type_list_index_of::value), 1); - CHECK_EQUAL((etl::type_list_index_of::value), 2); - CHECK_EQUAL((etl::type_list_index_of::value), etl::type_list_npos); + CHECK_EQUAL((etl::type_list_index_of_type::value), 0); + CHECK_EQUAL((etl::type_list_index_of_type::value), 1); + CHECK_EQUAL((etl::type_list_index_of_type::value), 2); + CHECK_EQUAL((etl::type_list_index_of_type::value), etl::type_list_npos); #if ETL_USING_CPP17 CHECK_EQUAL((etl::type_list_index_of_v), 0);