Browse Source

test: use shared transparent_equal_to type

Michele Caini 2 years ago
parent
commit
0f1fff7ac8
1 changed files with 3 additions and 12 deletions
  1. 3 12
      test/entt/container/dense_map.cpp

+ 3 - 12
test/entt/container/dense_map.cpp

@@ -15,19 +15,10 @@
 #include "../common/config.h"
 #include "../common/throwing_allocator.hpp"
 #include "../common/tracked_memory_resource.hpp"
-
-struct transparent_equal_to {
-    using is_transparent = void;
-
-    template<typename Type, typename Other>
-    constexpr std::enable_if_t<std::is_convertible_v<Other, Type>, bool>
-    operator()(const Type &lhs, const Other &rhs) const {
-        return lhs == static_cast<Type>(rhs);
-    }
-};
+#include "../common/transparent_equal_to.h"
 
 TEST(DenseMap, Functionalities) {
-    entt::dense_map<int, int, entt::identity, transparent_equal_to> map;
+    entt::dense_map<int, int, entt::identity, test::transparent_equal_to> map;
     const auto &cmap = map;
 
     ASSERT_NO_FATAL_FAILURE([[maybe_unused]] auto alloc = map.get_allocator());
@@ -927,7 +918,7 @@ TEST(DenseMap, Swap) {
 }
 
 TEST(DenseMap, EqualRange) {
-    entt::dense_map<int, int, entt::identity, transparent_equal_to> map;
+    entt::dense_map<int, int, entt::identity, test::transparent_equal_to> map;
     const auto &cmap = map;
 
     map.emplace(42, 3);