From 1aa963d469db4c617890f039b5ece3c14416b238 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 28 Mar 2023 17:43:00 +0100 Subject: [PATCH] Fix type traits generator --- .../etl/generators/type_traits_generator.h | 43 +++++++++++++------ include/etl/type_traits.h | 24 +++++------ version.txt | 2 +- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 83939a93..c692add8 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -118,8 +118,8 @@ namespace etl const T integral_constant::value; #if ETL_USING_CPP17 - template - using integral_constant_v = std::integral_constant::value; + template + inline constexpr T integral_constant_v = std::integral_constant::value; #endif #if ETL_USING_CPP11 @@ -130,6 +130,11 @@ namespace etl struct bool_constant : etl::integral_constant { }; #endif +#if ETL_USING_CPP17 + template + inline constexpr bool bool_constant_v = std::bool_constant::value; +#endif + //*************************************************************************** /// negation template @@ -816,20 +821,25 @@ namespace etl #else // Condition = ETL_USING_STL && ETL_USING_CPP11 - //***************************************************************************** - // Traits are derived from the STL - //***************************************************************************** +//***************************************************************************** +// Traits are derived from the STL +//***************************************************************************** - //*************************************************************************** - /// integral_constant - ///\ingroup type_traits - template - struct integral_constant : std::integral_constant {}; +//*************************************************************************** +/// integral_constant +///\ingroup type_traits +template +struct integral_constant : std::integral_constant {}; - /// integral_constant specialisations - ///\ingroup type_traits - typedef integral_constant false_type; - typedef integral_constant true_type; +/// integral_constant specialisations +///\ingroup type_traits +typedef integral_constant false_type; +typedef integral_constant true_type; + +#if ETL_USING_CPP17 + template + inline constexpr T integral_constant_v = std::integral_constant::value; +#endif #if ETL_USING_CPP17 template @@ -839,6 +849,11 @@ namespace etl struct bool_constant : std::integral_constant { }; #endif +#if ETL_USING_CPP17 + template + inline constexpr bool bool_constant_v = std::bool_constant::value; +#endif + //*************************************************************************** /// negation ///\ingroup type_traits diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index cf50a3e1..70ecac1a 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -809,20 +809,20 @@ namespace etl #else // Condition = ETL_USING_STL && ETL_USING_CPP11 - //***************************************************************************** - // Traits are derived from the STL - //***************************************************************************** +//***************************************************************************** +// Traits are derived from the STL +//***************************************************************************** - //*************************************************************************** - /// integral_constant - ///\ingroup type_traits - template - struct integral_constant : std::integral_constant {}; +//*************************************************************************** +/// integral_constant +///\ingroup type_traits +template +struct integral_constant : std::integral_constant {}; - /// integral_constant specialisations - ///\ingroup type_traits - typedef integral_constant false_type; - typedef integral_constant true_type; +/// integral_constant specialisations +///\ingroup type_traits +typedef integral_constant false_type; +typedef integral_constant true_type; #if ETL_USING_CPP17 template diff --git a/version.txt b/version.txt index 83873aa2..6b09ceca 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -20.35.14 +20.35.15