signal: swap based move assignment operators

This commit is contained in:
Michele Caini
2024-09-06 15:26:25 +02:00
parent 63d6db37d8
commit b485d72ec7
3 changed files with 4 additions and 4 deletions

View File

@@ -194,7 +194,7 @@ public:
*/
basic_dispatcher &operator=(basic_dispatcher &&other) noexcept {
ENTT_ASSERT(alloc_traits::is_always_equal::value || get_allocator() == other.get_allocator(), "Copying a dispatcher is not allowed");
pools = std::move(other.pools);
swap(other);
return *this;
}

View File

@@ -96,7 +96,7 @@ public:
*/
emitter &operator=(emitter &&other) noexcept {
ENTT_ASSERT(alloc_traits::is_always_equal::value || handlers.second() == other.handlers.second(), "Copying an emitter is not allowed");
handlers = std::move(other.handlers);
swap(other);
return *this;
}

View File

@@ -125,8 +125,8 @@ public:
* @param other The instance to move from.
* @return This signal handler.
*/
sigh &operator=(sigh &&other) noexcept(std::is_nothrow_move_assignable_v<container_type>) {
calls = std::move(other.calls);
sigh &operator=(sigh &&other) noexcept(std::is_nothrow_swappable_v<container_type>) {
swap(other);
return *this;
}