Browse Source

registry: all_of supports non-existing pools now

Michele Caini 2 years ago
parent
commit
3d3d3ef2d9
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/entt/entity/registry.hpp

+ 6 - 1
src/entt/entity/registry.hpp

@@ -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) && ...);
+    }
     }
 
     /**