Sfoglia il codice sorgente

slightly faster destroy

Michele Caini 6 anni fa
parent
commit
8d08ffc4ae
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  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);
     }