diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index abc763e88..eaec23a25 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -370,7 +370,8 @@ public: * @param entt A valid entity identifier. */ void destroy(const entity_type entt) override { - std::swap(instances[underlying_type::get(entt)], instances.back()); + auto other = std::move(instances.back()); + instances[underlying_type::get(entt)] = std::move(other); instances.pop_back(); underlying_type::destroy(entt); }