table: swap based move assignment operator

This commit is contained in:
Michele Caini
2024-09-06 15:24:46 +02:00
parent 5bb706ceea
commit d40e5f3dd5
2 changed files with 2 additions and 2 deletions

View File

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

View File

@@ -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'));