Browse Source

storage: use proper value type for entity storage

Michele Caini 3 years ago
parent
commit
62079908ce
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/entt/entity/storage.hpp
  2. 1 1
      test/entt/entity/storage_entity.cpp

+ 2 - 2
src/entt/entity/storage.hpp

@@ -971,7 +971,7 @@ public:
     /*! @brief Base type. */
     /*! @brief Base type. */
     using base_type = basic_sparse_set<Entity, Allocator>;
     using base_type = basic_sparse_set<Entity, Allocator>;
     /*! @brief Type of the objects assigned to entities. */
     /*! @brief Type of the objects assigned to entities. */
-    using value_type = void;
+    using value_type = Entity;
     /*! @brief Component traits. */
     /*! @brief Component traits. */
     using traits_type = component_traits<void>;
     using traits_type = component_traits<void>;
     /*! @brief Underlying entity identifier. */
     /*! @brief Underlying entity identifier. */
@@ -995,7 +995,7 @@ public:
      * @param allocator The allocator to use.
      * @param allocator The allocator to use.
      */
      */
     explicit basic_storage(const allocator_type &allocator)
     explicit basic_storage(const allocator_type &allocator)
-        : base_type{type_id<void>(), deletion_policy::swap_and_pop, allocator},
+        : base_type{type_id<value_type>(), deletion_policy::swap_and_pop, allocator},
           length{} {}
           length{} {}
 
 
     /**
     /**

+ 1 - 1
test/entt/entity/storage_entity.cpp

@@ -8,7 +8,7 @@
 TEST(StorageEntity, TypeAndPolicy) {
 TEST(StorageEntity, TypeAndPolicy) {
     entt::storage<entt::entity> pool;
     entt::storage<entt::entity> pool;
 
 
-    ASSERT_EQ(pool.type(), entt::type_id<void>());
+    ASSERT_EQ(pool.type(), entt::type_id<entt::entity>());
     ASSERT_EQ(pool.policy(), entt::deletion_policy::swap_and_pop);
     ASSERT_EQ(pool.policy(), entt::deletion_policy::swap_and_pop);
 }
 }