瀏覽代碼

core: drop type_identity[_t]

skypjack 3 月之前
父節點
當前提交
be2b93549f
共有 2 個文件被更改,包括 1 次插入22 次删除
  1. 0 21
      src/entt/core/type_traits.hpp
  2. 1 1
      test/entt/core/type_traits.cpp

+ 0 - 21
src/entt/core/type_traits.hpp

@@ -32,27 +32,6 @@ struct choice_t<0> {};
 template<std::size_t N>
 inline constexpr choice_t<N> choice{};
 
-/**
- * @brief Identity type trait.
- *
- * Useful to establish non-deduced contexts in template argument deduction
- * (waiting for C++20) or to provide types through function arguments.
- *
- * @tparam Type A type.
- */
-template<typename Type>
-struct type_identity {
-    /*! @brief Identity type. */
-    using type = Type;
-};
-
-/**
- * @brief Helper type.
- * @tparam Type A type.
- */
-template<typename Type>
-using type_identity_t = typename type_identity<Type>::type;
-
 /**
  * @brief A type-only `sizeof` wrapper that returns 0 where `sizeof` complains.
  * @tparam Type The type of which to return the size.

+ 1 - 1
test/entt/core/type_traits.cpp

@@ -119,7 +119,7 @@ TEST(TypeList, Functionalities) {
     testing::StaticAssertTypeEq<entt::type_list_diff_t<entt::type_list<int, char, double>, entt::type_list<char, double>>, entt::type_list<int>>();
     testing::StaticAssertTypeEq<entt::type_list_diff_t<entt::type_list<int, char, double>, entt::type_list<char>>, entt::type_list<int, double>>();
 
-    testing::StaticAssertTypeEq<entt::type_list_transform_t<entt::type_list<int, char>, entt::type_identity>, entt::type_list<int, char>>();
+    testing::StaticAssertTypeEq<entt::type_list_transform_t<entt::type_list<int, char>, std::type_identity>, entt::type_list<int, char>>();
     testing::StaticAssertTypeEq<entt::type_list_transform_t<entt::type_list<int, char>, std::add_const>, entt::type_list<const int, const char>>();
     testing::StaticAssertTypeEq<entt::type_list_transform_t<entt::type_list<int, char>, multi_argument_operation>, entt::type_list<void, void>>();