Browse Source

pool/registry: rename to avoid name clash with virtual functions

Michele Caini 5 years ago
parent
commit
fa5cce7477
2 changed files with 15 additions and 15 deletions
  1. 6 6
      src/entt/entity/pool.hpp
  2. 9 9
      src/entt/entity/registry.hpp

+ 6 - 6
src/entt/entity/pool.hpp

@@ -60,7 +60,7 @@ struct storage_adapter: basic_storage<Entity, Type> {
      * @brief Removes entities from a pool.
      * @brief Removes entities from a pool.
      * @param entity A valid entity identifier.
      * @param entity A valid entity identifier.
      */
      */
-    void erase(basic_registry<entity_type> &, const entity_type entity) {
+    void remove(basic_registry<entity_type> &, const entity_type entity) {
         basic_storage<entity_type, value_type>::erase(entity);
         basic_storage<entity_type, value_type>::erase(entity);
     }
     }
 
 
@@ -71,7 +71,7 @@ struct storage_adapter: basic_storage<Entity, Type> {
      * @param last An iterator past the last element of the range of entities.
      * @param last An iterator past the last element of the range of entities.
      */
      */
     template<typename It>
     template<typename It>
-    void erase(basic_registry<entity_type> &, It first, It last) {
+    void remove(basic_registry<entity_type> &, It first, It last) {
         basic_sparse_set<entity_type>::erase(first, last);
         basic_sparse_set<entity_type>::erase(first, last);
     }
     }
 
 
@@ -212,9 +212,9 @@ struct sigh_pool_mixin: Pool {
      * @param owner The registry that issued the request.
      * @param owner The registry that issued the request.
      * @param entity A valid entity identifier.
      * @param entity A valid entity identifier.
      */
      */
-    void erase(basic_registry<entity_type> &owner, const entity_type entity) {
+    void remove(basic_registry<entity_type> &owner, const entity_type entity) {
         destruction.publish(owner, entity);
         destruction.publish(owner, entity);
-        Pool::erase(owner, entity);
+        Pool::remove(owner, entity);
     }
     }
 
 
     /**
     /**
@@ -225,14 +225,14 @@ struct sigh_pool_mixin: Pool {
      * @param last An iterator past the last element of the range of entities.
      * @param last An iterator past the last element of the range of entities.
      */
      */
     template<typename It>
     template<typename It>
-    void erase(basic_registry<entity_type> &owner, It first, It last) {
+    void remove(basic_registry<entity_type> &owner, It first, It last) {
         if(!destruction.empty()) {
         if(!destruction.empty()) {
             for(auto it = first; it != last; ++it) {
             for(auto it = first; it != last; ++it) {
                 destruction.publish(owner, *it);
                 destruction.publish(owner, *it);
             }
             }
         }
         }
 
 
-        Pool::erase(owner, first, last);
+        Pool::remove(owner, first, last);
     }
     }
 
 
     /**
     /**

+ 9 - 9
src/entt/entity/registry.hpp

@@ -45,7 +45,7 @@ class basic_registry {
     struct pool_data {
     struct pool_data {
         type_info info{};
         type_info info{};
         std::unique_ptr<basic_sparse_set<Entity>> pool{};
         std::unique_ptr<basic_sparse_set<Entity>> pool{};
-        void(* erase)(basic_sparse_set<Entity> &, basic_registry &, const Entity *, const Entity *){};
+        void(* remove)(basic_sparse_set<Entity> &, basic_registry &, const Entity *, const Entity *){};
     };
     };
 
 
     template<typename...>
     template<typename...>
@@ -114,8 +114,8 @@ class basic_registry {
         if(auto &&pdata = pools[index]; !pdata.pool) {
         if(auto &&pdata = pools[index]; !pdata.pool) {
             pdata.info = type_id<Component>();
             pdata.info = type_id<Component>();
             pdata.pool.reset(new pool_t<Entity, Component>());
             pdata.pool.reset(new pool_t<Entity, Component>());
-            pdata.erase = +[](basic_sparse_set<Entity> &cpool, basic_registry &owner, const Entity *first, const Entity *last) {
-                static_cast<pool_t<Entity, Component> &>(cpool).erase(owner, first, last);
+            pdata.remove = +[](basic_sparse_set<Entity> &cpool, basic_registry &owner, const Entity *first, const Entity *last) {
+                static_cast<pool_t<Entity, Component> &>(cpool).remove(owner, first, last);
             };
             };
         }
         }
         
         
@@ -699,7 +699,7 @@ public:
     template<typename... Component>
     template<typename... Component>
     void remove(const entity_type entity) {
     void remove(const entity_type entity) {
         ENTT_ASSERT(valid(entity));
         ENTT_ASSERT(valid(entity));
-        (assure<Component>().erase(*this, entity), ...);
+        (assure<Component>().remove(*this, entity), ...);
     }
     }
 
 
     /**
     /**
@@ -715,7 +715,7 @@ public:
     template<typename... Component, typename It>
     template<typename... Component, typename It>
     void remove(It first, It last) {
     void remove(It first, It last) {
         ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }));
         ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); }));
-        (assure<Component>().erase(*this, first, last), ...);
+        (assure<Component>().remove(*this, first, last), ...);
     }
     }
 
 
     /**
     /**
@@ -743,7 +743,7 @@ public:
         ENTT_ASSERT(valid(entity));
         ENTT_ASSERT(valid(entity));
 
 
         return ([this, entity](auto &&cpool) {
         return ([this, entity](auto &&cpool) {
-            return cpool.contains(entity) ? (cpool.erase(*this, entity), true) : false;
+            return cpool.contains(entity) ? (cpool.remove(*this, entity), true) : false;
         }(assure<Component>()) + ... + size_type{});
         }(assure<Component>()) + ... + size_type{});
     }
     }
 
 
@@ -769,7 +769,7 @@ public:
 
 
         for(auto pos = pools.size(); pos; --pos) {
         for(auto pos = pools.size(); pos; --pos) {
             if(auto &pdata = pools[pos-1]; pdata.pool && pdata.pool->contains(entity)) {
             if(auto &pdata = pools[pos-1]; pdata.pool && pdata.pool->contains(entity)) {
-                pdata.erase(*pdata.pool, *this, std::begin(wrap), std::end(wrap));
+                pdata.remove(*pdata.pool, *this, std::begin(wrap), std::end(wrap));
             }
             }
         }
         }
     }
     }
@@ -923,7 +923,7 @@ public:
         if constexpr(sizeof...(Component) == 0) {
         if constexpr(sizeof...(Component) == 0) {
             for(auto pos = pools.size(); pos; --pos) {
             for(auto pos = pools.size(); pos; --pos) {
                 if(const auto &pdata = pools[pos-1]; pdata.pool) {
                 if(const auto &pdata = pools[pos-1]; pdata.pool) {
-                    pdata.erase(*pdata.pool, *this, pdata.pool->rbegin(), pdata.pool->rend());
+                    pdata.remove(*pdata.pool, *this, pdata.pool->rbegin(), pdata.pool->rend());
                 }
                 }
             }
             }
 
 
@@ -934,7 +934,7 @@ public:
             }
             }
         } else {
         } else {
             ([this](auto &&cpool) {
             ([this](auto &&cpool) {
-                cpool.erase(*this, cpool.basic_sparse_set<entity_type>::begin(), cpool.basic_sparse_set<entity_type>::end());
+                cpool.remove(*this, cpool.basic_sparse_set<entity_type>::begin(), cpool.basic_sparse_set<entity_type>::end());
             }(assure<Component>()), ...);
             }(assure<Component>()), ...);
         }
         }
     }
     }