registry: ::storage<T> doesn't accept const types anymore
This commit is contained in:
@@ -426,12 +426,8 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<typename Component>
|
||||
decltype(auto) storage(const id_type id = type_hash<std::remove_const_t<Component>>::value()) {
|
||||
if constexpr(std::is_const_v<Component>) {
|
||||
return std::as_const(*this).template storage<std::remove_const_t<Component>>(id);
|
||||
} else {
|
||||
return assure<Component>(id);
|
||||
}
|
||||
decltype(auto) storage(const id_type id = type_hash<Component>::value()) {
|
||||
return assure<Component>(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -446,8 +442,8 @@ public:
|
||||
* @return The storage for the given component type.
|
||||
*/
|
||||
template<typename Component>
|
||||
decltype(auto) storage(const id_type id = type_hash<std::remove_const_t<Component>>::value()) const {
|
||||
return assure<std::remove_const_t<Component>>(id);
|
||||
decltype(auto) storage(const id_type id = type_hash<Component>::value()) const {
|
||||
return assure<Component>(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1944,9 +1944,7 @@ TEST(Registry, RuntimePools) {
|
||||
const auto entity = registry.create();
|
||||
|
||||
static_assert(std::is_same_v<decltype(registry.storage<empty_type>()), typename entt::storage_traits<entt::entity, empty_type>::storage_type &>);
|
||||
static_assert(std::is_same_v<decltype(registry.storage<const empty_type>()), const typename entt::storage_traits<entt::entity, empty_type>::storage_type &>);
|
||||
static_assert(std::is_same_v<decltype(std::as_const(registry).storage<empty_type>()), const typename entt::storage_traits<entt::entity, empty_type>::storage_type &>);
|
||||
static_assert(std::is_same_v<decltype(std::as_const(registry).storage<const empty_type>()), const typename entt::storage_traits<entt::entity, empty_type>::storage_type &>);
|
||||
|
||||
static_assert(std::is_same_v<decltype(registry.storage("other"_hs)->second), typename entt::storage_traits<entt::entity, empty_type>::storage_type::base_type &>);
|
||||
static_assert(std::is_same_v<decltype(std::as_const(registry).storage("other"_hs)->second), const typename entt::storage_traits<entt::entity, empty_type>::storage_type::base_type &>);
|
||||
|
||||
Reference in New Issue
Block a user