diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 8d4753e6..9fd77c64 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -2569,31 +2569,31 @@ typedef integral_constant true_type; }; // Plain / cv-qualified - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; // Variadic - template - struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; // noexcept variants (if supported by the toolchain) #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; #endif #if ETL_USING_CPP17 @@ -2668,83 +2668,37 @@ typedef integral_constant true_type; } template - struct is_member_pointer : private_type_traits::is_member_pointer_helper> {}; + struct is_member_pointer : private_type_traits::is_member_pointer_helper::type> {}; #if ETL_USING_CPP17 template inline constexpr bool is_member_pointer_v = etl::is_member_pointer::value; #endif +#if ETL_USING_CPP11 //*************************************************************************** /// Is T a member function pointer //*************************************************************************** - template struct is_member_function_pointer : etl::false_type {}; + namespace private_type_traits + { + // Primary: not a member function pointer. + template + struct is_member_function_pointer_helper : etl::false_type + { + }; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; + // If the type is 'TMember TObject::*' then TMember is the member + // Uses etl::is_function to detect member function pointers. + template + struct is_member_function_pointer_helper : etl::is_function + { + }; + } -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; -#endif - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; - -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; -#endif - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; -#endif - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; - -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; + template + struct is_member_function_pointer : private_type_traits::is_member_function_pointer_helper> + { + }; #endif #if ETL_USING_CPP17 @@ -2752,6 +2706,7 @@ typedef integral_constant true_type; inline constexpr bool is_member_function_pointer_v = etl::is_member_function_pointer::value; #endif +#if ETL_USING_CPP11 //*************************************************************************** /// Is T a member object pointer //*************************************************************************** @@ -2768,6 +2723,7 @@ typedef integral_constant true_type; } template struct is_member_object_pointer : public private_type_traits::is_member_object_pointer_helper>::type {}; +#endif #if ETL_USING_CPP17 template diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 44dccad6..0d32608e 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -2562,31 +2562,31 @@ typedef integral_constant true_type; }; // Plain / cv-qualified - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; // Variadic - template - struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; // noexcept variants (if supported by the toolchain) #if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; - template - struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; + template + struct is_function : etl::true_type {}; #endif #if ETL_USING_CPP17 @@ -2661,83 +2661,37 @@ typedef integral_constant true_type; } template - struct is_member_pointer : private_type_traits::is_member_pointer_helper> {}; + struct is_member_pointer : private_type_traits::is_member_pointer_helper::type> {}; #if ETL_USING_CPP17 template inline constexpr bool is_member_pointer_v = etl::is_member_pointer::value; #endif +#if ETL_USING_CPP11 //*************************************************************************** /// Is T a member function pointer //*************************************************************************** - template struct is_member_function_pointer : etl::false_type {}; + namespace private_type_traits + { + // Primary: not a member function pointer. + template + struct is_member_function_pointer_helper : etl::false_type + { + }; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; + // If the type is 'TMember TObject::*' then TMember is the member + // Uses etl::is_function to detect member function pointers. + template + struct is_member_function_pointer_helper : etl::is_function + { + }; + } -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; -#endif - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; - -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; -#endif - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; -#endif - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; - -#if ETL_HAS_NOEXCEPT_FUNCTION_TYPE - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer : etl::true_type {}; - template struct is_member_function_pointer: etl::true_type {}; + template + struct is_member_function_pointer : private_type_traits::is_member_function_pointer_helper> + { + }; #endif #if ETL_USING_CPP17 @@ -2745,6 +2699,7 @@ typedef integral_constant true_type; inline constexpr bool is_member_function_pointer_v = etl::is_member_function_pointer::value; #endif +#if ETL_USING_CPP11 //*************************************************************************** /// Is T a member object pointer //*************************************************************************** @@ -2761,6 +2716,7 @@ typedef integral_constant true_type; } template struct is_member_object_pointer : public private_type_traits::is_member_object_pointer_helper>::type {}; +#endif #if ETL_USING_CPP17 template