From f907bc066a48602e5d0a1c548ecfbf2328ed7869 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 24 Mar 2023 16:48:30 +0100 Subject: [PATCH] snapshot: drop redundant checks and avoid unnecessary lookups --- src/entt/entity/snapshot.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index db0f8b804..fce650f0f 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -373,12 +373,10 @@ class basic_continuous_loader { template void remove_if_exists() { - for(auto &&ref: remloc) { - const auto local = ref.second.first; + auto &storage = reg->template storage(); - if(reg->valid(local)) { - reg->template remove(local); - } + for(auto &&ref: remloc) { + storage.remove(ref.second.first); } }