Просмотр исходного кода

snpashot: review/cleanup orphans but keep it in place

Michele Caini 2 лет назад
Родитель
Сommit
b1e47fc7d4
2 измененных файлов с 3 добавлено и 4 удалено
  1. 0 1
      TODO
  2. 3 3
      src/entt/entity/snapshot.hpp

+ 0 - 1
TODO

@@ -13,7 +13,6 @@ TODO (high prio):
 * resource cache: avoid using shared ptr with loader and the others
 * further optimize exclusion lists in multi type views (no existence check)
 * doc: bump entities
-* deprecate/drop snapshot orphans function, make it a general purpose one
 * view with entity storage: begin/end should return filtered iterators
 * update view doc: single vs multi type views are no longer a thing actually
 * meta container: add value type to resize

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

@@ -25,11 +25,11 @@ namespace internal {
 
 template<typename Registry>
 void orphans(Registry &registry) {
-    auto view = registry.template view<typename Registry::entity_type>();
+    auto &storage = registry.template storage<typename Registry::entity_type>();
 
-    for(auto entt: view) {
+    for(auto entt: storage) {
         if(registry.orphan(entt)) {
-            view.storage()->erase(entt);
+            storage.erase(entt);
         }
     }
 }