registry: ::assure sets a constraint on the type

This commit is contained in:
Michele Caini
2020-04-01 00:16:35 +02:00
parent 52aa9ab761
commit 53fa0d2fe8

View File

@@ -186,6 +186,7 @@ class basic_registry {
template<typename Component>
const pool_handler<Component> & assure() const {
static_assert(std::is_same_v<Component, std::decay_t<Component>>);
static std::size_t index{pools.size()};
if(const auto length = pools.size(); !(index < length) || pools[index].type_id != type_info<Component>::id()) {