From b6d0921177a86f1e647ba55dff6beb2a75336860 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 19 Dec 2023 10:53:19 +0100 Subject: [PATCH] registry: use sort_as rather than pack --- src/entt/entity/registry.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 9f7eb1df4..e3ec96d20 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -556,11 +556,13 @@ public: */ template void destroy(It first, It last) { - const auto from = entities.each().cbegin().base(); - const auto to = from + entities.pack(first, last); + entities.sort_as(first, last); - for(size_type pos = pools.size(); pos; --pos) { - pools.begin()[pos - 1u].second->remove(from, to); + const auto from = entities.cbegin(0); + const auto to = from + std::distance(first, last); + + for(auto &&curr: pools) { + curr.second->remove(from, to); } entities.erase(from, to);