Browse Source

table: swap based move assignment operator

Michele Caini 1 year ago
parent
commit
d40e5f3dd5
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/entt/container/table.hpp
  2. 1 1
      test/entt/container/table.cpp

+ 1 - 1
src/entt/container/table.hpp

@@ -252,7 +252,7 @@ public:
      * @return This container.
      */
     basic_table &operator=(basic_table &&other) noexcept {
-        payload = std::move(other.payload);
+        swap(other);
         return *this;
     }
 

+ 1 - 1
test/entt/container/table.cpp

@@ -90,7 +90,7 @@ TEST(Table, Move) {
     other = std::move(table);
     test::is_initialized(table);
 
-    ASSERT_TRUE(table.empty());
+    ASSERT_FALSE(table.empty());
     ASSERT_FALSE(other.empty());
 
     ASSERT_EQ(other[0u], std::make_tuple(3, 'c'));