Michele Caini пре 6 година
родитељ
комит
f3aed46c94
2 измењених фајлова са 4 додато и 5 уклоњено
  1. 1 1
      TODO
  2. 3 4
      src/entt/entity/registry.hpp

+ 1 - 1
TODO

@@ -28,8 +28,8 @@ TODO
   - assign<T...>(first, last)
   - assign<T...>(first, last)
 * use unordered_map for named pools and context variables:
 * use unordered_map for named pools and context variables:
   - use direct access (pool-like) also for context variables
   - use direct access (pool-like) also for context variables
+  - allow for key/value variables where the key is an ENTT_ID_TYPE
   - improves multi-stomp
   - improves multi-stomp
-* improve registry::alive
 * multi component registry::remove and some others?
 * multi component registry::remove and some others?
 * range based registry::remove and some others?
 * range based registry::remove and some others?
 * nested groups: AB/ABC/ABCD/... (hints: sort, check functions)
 * nested groups: AB/ABC/ABCD/... (hints: sort, check functions)

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

@@ -373,15 +373,14 @@ public:
      * @return Number of entities still in use.
      * @return Number of entities still in use.
      */
      */
     size_type alive() const ENTT_NOEXCEPT {
     size_type alive() const ENTT_NOEXCEPT {
+        auto sz = entities.size();
         auto curr = destroyed;
         auto curr = destroyed;
-        size_type cnt{};
 
 
-        while(curr != null) {
+        for(; curr != null; --sz) {
             curr = entities[to_integer(curr) & traits_type::entity_mask];
             curr = entities[to_integer(curr) & traits_type::entity_mask];
-            ++cnt;
         }
         }
 
 
-        return entities.size() - cnt;
+        return sz;
     }
     }
 
 
     /**
     /**