diff --git a/AUTHORS b/AUTHORS index ef39ca464..ff7c2a3d5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -7,6 +7,7 @@ skypjack BenediktConze bjadamson ceeac +ColinH corystegel Croydon dbacchet diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 77a92bef4..ca5eea3e4 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -98,9 +98,7 @@ class basic_registry { Component & replace(const Entity entt, Args &&... args) { Component component{std::forward(args)...}; on_replace.publish(*owner, entt, component); - auto &other = sparse_set::get(entt); - std::swap(other, component); - return other; + return (sparse_set::get(entt) = std::move(component)); } };