Michele Caini 6 yıl önce
ebeveyn
işleme
7e0ea176cf

+ 0 - 1
TODO

@@ -33,4 +33,3 @@ TODO
 * multi component registry::remove and some others?
 * range based registry::remove and some others?
 * nested groups: AB/ABC/ABCD/... (hints: sort, check functions)
-* ::size_type - c'mon

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

@@ -93,9 +93,9 @@ class basic_group<Entity, exclude_t<Exclude...>, get_t<Get, Other...>> {
 
 public:
     /*! @brief Underlying entity identifier. */
-    using entity_type = typename sparse_set<Entity>::entity_type;
+    using entity_type = Entity;
     /*! @brief Unsigned integer type. */
-    using size_type = typename sparse_set<Entity>::size_type;
+    using size_type = std::size_t;
     /*! @brief Input iterator type. */
     using iterator_type = typename sparse_set<Entity>::iterator_type;
 
@@ -494,7 +494,7 @@ class basic_group<Entity, exclude_t<Exclude...>, get_t<Get...>, Owned, Other...>
     using component_iterator_type = decltype(std::declval<pool_type<Component>>().begin());
 
     // we could use pool_type<Type> *..., but vs complains about it and refuses to compile for unknown reasons (most likely a bug)
-    basic_group(const typename basic_registry<Entity>::size_type *sz, storage<Entity, std::remove_const_t<Owned>> *owned, storage<Entity, std::remove_const_t<Other>> *... other, storage<Entity, std::remove_const_t<Get>> *... get) ENTT_NOEXCEPT
+    basic_group(const std::size_t *sz, storage<Entity, std::remove_const_t<Owned>> *owned, storage<Entity, std::remove_const_t<Other>> *... other, storage<Entity, std::remove_const_t<Get>> *... get) ENTT_NOEXCEPT
         : length{sz},
           pools{owned, other..., get...}
     {}
@@ -521,9 +521,9 @@ class basic_group<Entity, exclude_t<Exclude...>, get_t<Get...>, Owned, Other...>
 
 public:
     /*! @brief Underlying entity identifier. */
-    using entity_type = typename sparse_set<Entity>::entity_type;
+    using entity_type = Entity;
     /*! @brief Unsigned integer type. */
-    using size_type = typename sparse_set<Entity>::size_type;
+    using size_type = std::size_t;
     /*! @brief Input iterator type. */
     using iterator_type = typename sparse_set<Entity>::iterator_type;
 
@@ -838,7 +838,7 @@ public:
     }
 
 private:
-    const typename basic_registry<Entity>::size_type *length;
+    const size_type *length;
     const std::tuple<pool_type<Owned> *, pool_type<Other> *..., pool_type<Get> *...> pools;
 };
 

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

@@ -323,7 +323,7 @@ public:
     /*! @brief Underlying version type. */
     using version_type = typename traits_type::version_type;
     /*! @brief Unsigned integer type. */
-    using size_type = typename sparse_set<Entity>::size_type;
+    using size_type = std::size_t;
 
     /*! @brief Default constructor. */
     basic_registry() ENTT_NOEXCEPT = default;

+ 1 - 1
src/entt/entity/view.hpp

@@ -155,8 +155,8 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
     }
 
     unchecked_type unchecked(const sparse_set<Entity> *view) const ENTT_NOEXCEPT {
+        std::size_t pos{};
         unchecked_type other{};
-        typename unchecked_type::size_type pos{};
         ((std::get<pool_type<Component> *>(pools) == view ? nullptr : (other[pos++] = std::get<pool_type<Component> *>(pools))), ...);
         return other;
     }

+ 1 - 1
src/entt/process/scheduler.hpp

@@ -111,7 +111,7 @@ class scheduler {
 
 public:
     /*! @brief Unsigned integer type. */
-    using size_type = typename std::vector<process_handler>::size_type;
+    using size_type = std::size_t;
 
     /*! @brief Default constructor. */
     scheduler() ENTT_NOEXCEPT = default;

+ 3 - 6
src/entt/resource/cache.hpp

@@ -26,12 +26,9 @@ namespace entt {
  * @tparam Resource Type of resources managed by a cache.
  */
 template<typename Resource>
-class resource_cache {
-    using container_type = std::unordered_map<ENTT_ID_TYPE, std::shared_ptr<Resource>>;
-
-public:
+struct resource_cache {
     /*! @brief Unsigned integer type. */
-    using size_type = typename container_type::size_type;
+    using size_type = std::size_t;
     /*! @brief Type of resources managed by a cache. */
     using resource_type = ENTT_ID_TYPE;
 
@@ -231,7 +228,7 @@ public:
     }
 
 private:
-    container_type resources;
+    std::unordered_map<resource_type, std::shared_ptr<Resource>> resources;
 };
 
 

+ 1 - 1
src/entt/resource/fwd.hpp

@@ -10,7 +10,7 @@ namespace entt {
 
 /*! @class resource_cache */
 template<typename>
-class resource_cache;
+struct resource_cache;
 
 /*! @class resource_handle */
 template<typename>

+ 1 - 1
src/entt/signal/sigh.hpp

@@ -62,7 +62,7 @@ class sigh<Ret(Args...)> {
 
 public:
     /*! @brief Unsigned integer type. */
-    using size_type = typename std::vector<delegate<Ret(Args...)>>::size_type;
+    using size_type = std::size_t;
     /*! @brief Sink type. */
     using sink_type = entt::sink<Ret(Args...)>;