|
@@ -17,15 +17,47 @@ class basic_sparse_set;
|
|
|
template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
|
|
template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
|
|
|
class basic_storage;
|
|
class basic_storage;
|
|
|
|
|
|
|
|
-template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
|
|
|
|
|
-struct storage_type;
|
|
|
|
|
-
|
|
|
|
|
-template<typename Type, typename = entity, typename = std::allocator<std::remove_const_t<Type>>>
|
|
|
|
|
-struct storage_for;
|
|
|
|
|
-
|
|
|
|
|
template<typename Type>
|
|
template<typename Type>
|
|
|
class sigh_storage_mixin;
|
|
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 Type, typename Entity = entity, typename Allocator = std::allocator<Type>, typename = void>
|
|
|
|
|
+struct storage_type {
|
|
|
|
|
+ /*! @brief Type-to-storage conversion result. */
|
|
|
|
|
+ using type = sigh_storage_mixin<basic_storage<Type, Entity, Allocator>>;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @brief Helper type.
|
|
|
|
|
+ * @tparam Args Arguments to forward.
|
|
|
|
|
+ */
|
|
|
|
|
+template<typename... Args>
|
|
|
|
|
+using storage_type_t = typename storage_type<Args...>::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<typename Type, typename Entity = entity, typename Allocator = std::allocator<std::remove_const_t<Type>>>
|
|
|
|
|
+struct storage_for {
|
|
|
|
|
+ /*! @brief Type-to-storage conversion result. */
|
|
|
|
|
+ using type = constness_as_t<storage_type_t<std::remove_const_t<Type>, Entity, Allocator>, Type>;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @brief Helper type.
|
|
|
|
|
+ * @tparam Args Arguments to forward.
|
|
|
|
|
+ */
|
|
|
|
|
+template<typename... Args>
|
|
|
|
|
+using storage_for_t = typename storage_for<Args...>::type;
|
|
|
|
|
+
|
|
|
template<typename Entity = entity, typename = std::allocator<Entity>>
|
|
template<typename Entity = entity, typename = std::allocator<Entity>>
|
|
|
class basic_registry;
|
|
class basic_registry;
|
|
|
|
|
|