Просмотр исходного кода

storage: update basic_storage definition

skypjack 1 месяц назад
Родитель
Сommit
22d39a0163
2 измененных файлов с 5 добавлено и 4 удалено
  1. 2 2
      src/entt/entity/fwd.hpp
  2. 3 2
      src/entt/entity/storage.hpp

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

@@ -49,7 +49,7 @@ struct component_traits;
 template<entity_like Entity = entity, typename = std::allocator<Entity>>
 class basic_sparse_set;
 
-template<typename Type, entity_like = entity, typename = std::allocator<Type>, typename = void>
+template<typename Type, entity_like = entity, typename = std::allocator<Type>>
 class basic_storage;
 
 template<typename, typename>
@@ -240,7 +240,7 @@ struct type_list_transform<owned_t<Type...>, Op> {
  * @tparam Entity A valid entity type.
  * @tparam Allocator Type of allocator used to manage memory and elements.
  */
-template<typename Type, entity_like Entity = entity, typename Allocator = std::allocator<Type>, typename = void>
+template<typename Type, entity_like Entity = entity, typename Allocator = std::allocator<Type>>
 struct storage_type {
     /*! @brief Type-to-storage conversion result. */
     using type = ENTT_STORAGE(sigh_mixin, basic_storage<Type, Entity, Allocator>);

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

@@ -203,7 +203,7 @@ private:
  * @tparam Entity A valid entity type.
  * @tparam Allocator Type of allocator used to manage memory and elements.
  */
-template<typename Type, entity_like Entity, typename Allocator, typename>
+template<typename Type, entity_like Entity, typename Allocator>
 class basic_storage: public basic_sparse_set<Entity, typename std::allocator_traits<Allocator>::template rebind_alloc<Entity>> {
     using alloc_traits = std::allocator_traits<Allocator>;
     static_assert(std::is_same_v<typename alloc_traits::value_type, Type>, "Invalid value type");
@@ -762,7 +762,8 @@ private:
 
 /*! @copydoc basic_storage */
 template<typename Type, entity_like Entity, typename Allocator>
-class basic_storage<Type, Entity, Allocator, std::enable_if_t<component_traits<Type, Entity>::page_size == 0u>>
+requires (component_traits<Type, Entity>::page_size == 0u)
+class basic_storage<Type, Entity, Allocator>
     : public basic_sparse_set<Entity, typename std::allocator_traits<Allocator>::template rebind_alloc<Entity>> {
     using alloc_traits = std::allocator_traits<Allocator>;
     static_assert(std::is_same_v<typename alloc_traits::value_type, Type>, "Invalid value type");