registry: pass the allocator to the pools

This commit is contained in:
Michele Caini
2022-09-20 16:04:14 +02:00
parent 17f47fbc92
commit cf12765738
2 changed files with 6 additions and 3 deletions

3
TODO
View File

@@ -11,6 +11,9 @@ DOC:
* examples (and credits) from @alanjfs :)
* update entity doc when the storage based model is in place
TODO (high prio):
* remove the static storage from the const assure in the registry
WIP:
* get rid of observers, storage based views made them pointless - document alternatives
* add storage getter for filters to views and groups

View File

@@ -255,7 +255,7 @@ class basic_registry {
using entity_traits = entt_traits<Entity>;
template<typename Type>
using storage_for_type = typename storage_for<Type, Entity>::type;
using storage_for_type = typename storage_for<Type, Entity, typename alloc_traits::template rebind_alloc<std::remove_const_t<Type>>>::type;
template<typename...>
struct group_handler;
@@ -312,7 +312,7 @@ class basic_registry {
auto &cpool = pools[id];
if(!cpool) {
cpool.reset(new storage_for_type<Type>{});
cpool.reset(new storage_for_type<Type>{get_allocator()});
cpool->bind(forward_as_any(*this));
}
@@ -329,7 +329,7 @@ class basic_registry {
return static_cast<const storage_for_type<Type> &>(*it->second);
}
static storage_for_type<Type> placeholder{};
static storage_for_type<Type> placeholder{get_allocator()};
return placeholder;
}