Explorar o código

slightly faster destroy

Michele Caini %!s(int64=6) %!d(string=hai) anos
pai
achega
8d08ffc4ae
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/entt/entity/storage.hpp

+ 2 - 1
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);
     }