Prechádzať zdrojové kódy

registry: use sort_as rather than pack

Michele Caini 2 rokov pred
rodič
commit
b6d0921177
1 zmenil súbory, kde vykonal 6 pridanie a 4 odobranie
  1. 6 4
      src/entt/entity/registry.hpp

+ 6 - 4
src/entt/entity/registry.hpp

@@ -556,11 +556,13 @@ public:
      */
      */
     template<typename It>
     template<typename It>
     void destroy(It first, It last) {
     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);
         entities.erase(from, to);