From 4737fd0f0366d1997a760e9c02ec2ecc6b987936 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 10 Mar 2024 20:23:30 +0000 Subject: [PATCH] Removed etl::type_tag and replaced its use with etl::in_place_type_t --- include/etl/shared_message.h | 4 +-- include/etl/utility.h | 50 --------------------------- test/test_utility.cpp | 66 ------------------------------------ 3 files changed, 2 insertions(+), 118 deletions(-) diff --git a/include/etl/shared_message.h b/include/etl/shared_message.h index 36771ac7..f733ebb9 100644 --- a/include/etl/shared_message.h +++ b/include/etl/shared_message.h @@ -55,7 +55,7 @@ namespace etl template static shared_message create(TPool& owner, TArgs&&... args) { - return shared_message(owner, etl::type_tag(), etl::forward(args)...); + return shared_message(owner, etl::in_place_type_t(), etl::forward(args)...); } //************************************************************************* @@ -79,7 +79,7 @@ namespace etl /// Constructor //************************************************************************* template - shared_message(TPool& owner, etl::type_tag, TArgs&&... args) + shared_message(TPool& owner, etl::in_place_type_t, TArgs&&... args) { ETL_STATIC_ASSERT((etl::is_base_of::value), "TPool not derived from etl::ireference_counted_message_pool"); ETL_STATIC_ASSERT((etl::is_base_of::value), "TMessage not derived from etl::imessage"); diff --git a/include/etl/utility.h b/include/etl/utility.h index 5146eb3e..52cf0d37 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -672,56 +672,6 @@ namespace etl } }; #endif - - //***************************************************************************** - /// A tag that can be used as a concrete object to identify a type. - //***************************************************************************** - template - struct type_tag - { - typedef T type; - typedef typename etl::remove_cvref::type underlying_type; - }; - - //*********************************** - /// Equality operator for type_tag - //*********************************** - template - ETL_CONSTEXPR bool operator ==(etl::type_tag, etl::type_tag) - { - return etl::is_same, etl::type_tag >::value; - } - - //*********************************** - /// Inequality operator for type_tag - //*********************************** - template - ETL_CONSTEXPR bool operator !=(etl::type_tag, etl::type_tag) - { - return !etl::is_same, etl::type_tag >::value; - } - -#if ETL_USING_CPP11 - //*********************************** - /// type_tag type - //*********************************** - template - using type_tag_t = typename etl::type_tag::type; - - //*********************************** - /// type_tag underlying type - //*********************************** - template - using type_tag_underlying_t = typename etl::type_tag::underlying_type; -#endif - -#if ETL_USING_CPP17 - //*********************************** - /// constexpr type_tag value - //*********************************** - template - inline constexpr etl::type_tag type_tag_v = etl::type_tag{}; -#endif } #endif diff --git a/test/test_utility.cpp b/test/test_utility.cpp index f193f58f..a1f28e95 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -666,71 +666,5 @@ namespace CHECK_EQUAL(forward_like_call_type::ConstRValue, template_function_fl(etl::move(u4))); CHECK_EQUAL(forward_like_call_type::ConstRValue, template_function_fl(etl::move(u4))); } - - //********************************* - TEST(test_type_tag) - { - using TypeTag1 = etl::type_tag; - using TypeTag2 = etl::type_tag; - using TypeTag3 = etl::type_tag; - - TypeTag1 typeTag1; - TypeTag2 typeTag2; - TypeTag3 typeTag3; - - CHECK_TRUE(typeTag1 == typeTag1); - CHECK_TRUE(typeTag2 == typeTag2); - CHECK_TRUE(typeTag3 == typeTag3); - - CHECK_FALSE(typeTag1 == typeTag2); - CHECK_FALSE(typeTag2 == typeTag3); - CHECK_FALSE(typeTag3 == typeTag1); - - CHECK_FALSE(typeTag1 != typeTag1); - CHECK_FALSE(typeTag2 != typeTag2); - CHECK_FALSE(typeTag3 != typeTag3); - - CHECK_TRUE(typeTag1 != typeTag2); - CHECK_TRUE(typeTag2 != typeTag3); - CHECK_TRUE(typeTag3 != typeTag1); - } - - //********************************* - TEST(test_type_tag_t) - { - using TypeTagType1 = etl::type_tag_t; - using TypeTagType2 = etl::type_tag_t; - using TypeTagType3 = etl::type_tag_t; - - CHECK_FALSE((std::is_same::value)); - CHECK_FALSE((std::is_same::value)); - CHECK_FALSE((std::is_same::value)); - } - - //********************************* - TEST(test_type_tag_underlying_t) - { - using TypeTagType1 = etl::type_tag_underlying_t; - using TypeTagType2 = etl::type_tag_underlying_t; - using TypeTagType3 = etl::type_tag_underlying_t; - - CHECK_TRUE((std::is_same::value)); - CHECK_TRUE((std::is_same::value)); - CHECK_TRUE((std::is_same::value)); - } - - //********************************* -#if ETL_USING_CPP17 - TEST(test_type_tag_v) - { - constexpr auto typeTag1 = etl::type_tag_v; - constexpr auto typeTag2 = etl::type_tag_v; - constexpr auto typeTag3 = etl::type_tag_v; - - CHECK_TRUE(typeTag1 == typeTag1); - CHECK_TRUE(typeTag2 == typeTag2); - CHECK_TRUE(typeTag3 == typeTag3); - } -#endif }; }