From 0038728be381ee6c226b6b2ae9a390139b0ced86 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 8 Nov 2020 01:06:06 +0100 Subject: [PATCH] storage: removed const T specialization for storage_traits --- src/entt/entity/group.hpp | 4 ++-- src/entt/entity/registry.hpp | 3 ++- src/entt/entity/storage.hpp | 8 -------- src/entt/entity/view.hpp | 4 ++-- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index 00601be24..6fb325686 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -69,7 +69,7 @@ class basic_group, get_t> final { friend class basic_registry; template - using storage_type = typename storage_traits::storage_type; + using storage_type = constness_as_t>::storage_type, Component>; class iterable_group final { friend class basic_group, get_t>; @@ -574,7 +574,7 @@ class basic_group, get_t, Owned...> final friend class basic_registry; template - using storage_type = typename storage_traits::storage_type; + using storage_type = constness_as_t>::storage_type, Component>; class iterable_group final { friend class basic_group, get_t, Owned...>; diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 8a99a76f0..2a47748ed 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -14,6 +14,7 @@ #include "../core/algorithm.hpp" #include "../core/fwd.hpp" #include "../core/type_info.hpp" +#include "../core/type_traits.hpp" #include "entity.hpp" #include "fwd.hpp" #include "group.hpp" @@ -42,7 +43,7 @@ class basic_registry { using traits_type = entt_traits; template - using storage_type = typename storage_traits::storage_type; + using storage_type = constness_as_t>::storage_type, Component>; struct pool_data { type_info info{}; diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index 72380296b..9ab671049 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -806,14 +806,6 @@ struct storage_traits { }; -/*! @copydoc storage_traits */ -template -struct storage_traits { - /*! @brief Resulting type after component-to-storage conversion. */ - using storage_type = std::add_const_t>::storage_type>; -}; - - /** * @brief Gets the element associated with an entity from a storage, if any. * @tparam Type Storage type. diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index fbf0cfb2e..696559664 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -69,7 +69,7 @@ class basic_view, Component...> final { friend class basic_registry; template - using storage_type = typename storage_traits::storage_type; + using storage_type = constness_as_t>::storage_type, Comp>; using unchecked_type = std::array *, (sizeof...(Component) - 1)>; @@ -558,7 +558,7 @@ class basic_view, Component> final { /*! @brief A registry is allowed to create views. */ friend class basic_registry; - using storage_type = typename storage_traits::storage_type; + using storage_type = constness_as_t>::storage_type, Component>; class iterable_view { friend class basic_view, Component>;