registry: make storage_for_type available to the final user

This commit is contained in:
Michele Caini
2023-04-14 12:37:05 +02:00
parent 4d57d5c327
commit 686a3b9d79

View File

@@ -243,9 +243,6 @@ class basic_registry {
using alloc_traits = std::allocator_traits<Allocator>;
static_assert(std::is_same_v<typename alloc_traits::value_type, Entity>, "Invalid value type");
template<typename Type>
using storage_for_type = typename storage_for<Type, Entity, typename alloc_traits::template rebind_alloc<std::remove_const_t<Type>>>::type;
// std::shared_ptr because of its type erased allocator which is useful here
using pool_container_type = dense_map<id_type, std::shared_ptr<base_type>, identity, std::equal_to<id_type>, typename alloc_traits::template rebind_alloc<std::pair<const id_type, std::shared_ptr<base_type>>>>;
using group_container_type = dense_map<id_type, std::shared_ptr<internal::group_descriptor>, identity, std::equal_to<id_type>, typename alloc_traits::template rebind_alloc<std::pair<const id_type, std::shared_ptr<internal::group_descriptor>>>>;
@@ -308,6 +305,13 @@ public:
/*! @brief Context type. */
using context = internal::registry_context<allocator_type>;
/**
* @copybrief storage_for
* @tparam Type Storage value type, eventually const.
*/
template<typename Type>
using storage_for_type = typename storage_for<Type, Entity, typename alloc_traits::template rebind_alloc<std::remove_const_t<Type>>>::type;
/*! @brief Default constructor. */
basic_registry()
: basic_registry{allocator_type{}} {}