Browse Source

snapshot: drop redundant checks and avoid unnecessary lookups

Michele Caini 3 years ago
parent
commit
f907bc066a
1 changed files with 3 additions and 5 deletions
  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>
     template<typename Component>
     void remove_if_exists() {
     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);
         }
         }
     }
     }