diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index e55d1221..bc5edbea 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -1405,19 +1405,19 @@ typedef integral_constant true_type; //*************************************************************************** /// Template to determine if a type is a base of all types in a specified list. ///\ingroup types - template - struct is_base_of_all + template + struct is_base_of_all; + + template + struct is_base_of_all : etl::true_type { - static const bool value = etl::is_base_of::value && - etl::is_base_of_all::value; }; - template - struct is_base_of_all + template + struct is_base_of_all : etl::integral_constant::value && + etl::is_base_of_all::value> { - static const bool value = etl::is_base_of::value; }; -#endif #if ETL_USING_CPP17 template diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 327f164b..b75118ed 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -1398,23 +1398,24 @@ typedef integral_constant true_type; //*************************************************************************** /// Template to determine if a type is a base of all types in a specified list. ///\ingroup types - template - struct is_base_of_all + template + struct is_base_of_all; + + template + struct is_base_of_all : etl::true_type { - static const bool value = etl::is_base_of::value && - etl::is_base_of_all::value; }; - template - struct is_base_of_all + template + struct is_base_of_all : etl::integral_constant::value && + etl::is_base_of_all::value> { - static const bool value = etl::is_base_of::value; }; #endif #if ETL_USING_CPP17 - template - inline constexpr bool is_base_of_all_v = etl::is_base_of_all::value; + template + inline constexpr bool is_base_of_all_v = etl::is_base_of_all::value; #endif #if ETL_USING_CPP11 diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index 4316a697..37d620cd 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -1320,9 +1320,11 @@ namespace struct D4 {}; #if ETL_USING_CPP17 + CHECK_TRUE(bool(etl::is_base_of_all_v)); CHECK_TRUE(bool(etl::is_base_of_all_v)); CHECK_FALSE(bool(etl::is_base_of_all_v)); #else + CHECK_TRUE(bool(etl::is_base_of_all::value)); CHECK_TRUE(bool(etl::is_base_of_all::value)); CHECK_FALSE(bool(etl::is_base_of_all::value)); #endif