From cd541f335ab2208ebfd5d81305ddc48adedf27d9 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 17 Nov 2022 17:48:11 +0100 Subject: [PATCH] storage: * move storage_type[_t] and storage_for[_t] to fwd.hpp * no need to include storage.hpp when forward defining views --- src/entt/entity/fwd.hpp | 44 ++++++++++++++++++++++++++++++++----- src/entt/entity/storage.hpp | 38 -------------------------------- 2 files changed, 38 insertions(+), 44 deletions(-) diff --git a/src/entt/entity/fwd.hpp b/src/entt/entity/fwd.hpp index 8cc49aa258..e0245ca9ab 100644 --- a/src/entt/entity/fwd.hpp +++ b/src/entt/entity/fwd.hpp @@ -17,15 +17,47 @@ class basic_sparse_set; template, typename = void> class basic_storage; -template, typename = void> -struct storage_type; - -template>> -struct storage_for; - template class sigh_storage_mixin; +/** + * @brief Provides a common way to define storage types. + * @tparam Type Storage value type. + * @tparam Entity A valid entity type (see entt_traits for more details). + * @tparam Allocator Type of allocator used to manage memory and elements. + */ +template, typename = void> +struct storage_type { + /*! @brief Type-to-storage conversion result. */ + using type = sigh_storage_mixin>; +}; + +/** + * @brief Helper type. + * @tparam Args Arguments to forward. + */ +template +using storage_type_t = typename storage_type::type; + +/** + * Type-to-storage conversion utility that preserves constness. + * @tparam Type Storage value type, eventually const. + * @tparam Entity A valid entity type (see entt_traits for more details). + * @tparam Allocator Type of allocator used to manage memory and elements. + */ +template>> +struct storage_for { + /*! @brief Type-to-storage conversion result. */ + using type = constness_as_t, Entity, Allocator>, Type>; +}; + +/** + * @brief Helper type. + * @tparam Args Arguments to forward. + */ +template +using storage_for_t = typename storage_for::type; + template> class basic_registry; diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index dfe9b226e9..87b21640f0 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -898,44 +898,6 @@ class basic_storage -struct storage_type { - /*! @brief Type-to-storage conversion result. */ - using type = sigh_storage_mixin>; -}; - -/** - * @brief Helper type. - * @tparam Args Arguments to forward. - */ -template -using storage_type_t = typename storage_type::type; - -/** - * Type-to-storage conversion utility that preserves constness. - * @tparam Type Storage value type, eventually const. - * @tparam Entity A valid entity type (see entt_traits for more details). - * @tparam Allocator Type of allocator used to manage memory and elements. - */ -template -struct storage_for { - /*! @brief Type-to-storage conversion result. */ - using type = constness_as_t, Entity, Allocator>, Type>; -}; - -/** - * @brief Helper type. - * @tparam Args Arguments to forward. - */ -template -using storage_for_t = typename storage_for::type; - } // namespace entt #endif