Parcourir la source

snapshot: drop redundant checks and avoid unnecessary lookups

Michele Caini il y a 3 ans
Parent
commit
f907bc066a
1 fichiers modifiés avec 3 ajouts et 5 suppressions
  1. 3 5
      src/entt/entity/snapshot.hpp

+ 3 - 5
src/entt/entity/snapshot.hpp

@@ -373,12 +373,10 @@ class basic_continuous_loader {
 
     template<typename Component>
     void remove_if_exists() {
-        for(auto &&ref: remloc) {
-            const auto local = ref.second.first;
+        auto &storage = reg->template storage<Component>();
 
-            if(reg->valid(local)) {
-                reg->template remove<Component>(local);
-            }
+        for(auto &&ref: remloc) {
+            storage.remove(ref.second.first);
         }
     }