registry: all_of supports non-existing pools now

This commit is contained in:
Michele Caini
2023-04-28 16:28:13 +02:00
parent a7120b3400
commit 3d3d3ef2d9

View File

@@ -961,7 +961,12 @@ public:
*/
template<typename... Type>
[[nodiscard]] bool all_of(const entity_type entt) const {
return (assure<std::remove_const_t<Type>>()->contains(entt) && ...);
if constexpr(sizeof...(Type) == 1u) {
auto *cpool = assure<std::remove_const_t<Type>...>();
return cpool && cpool->contains(entt);
} else {
return (all_of<Type>(entt) && ...);
}
}
/**