Explorar o código

registry: all_of supports non-existing pools now

Michele Caini %!s(int64=3) %!d(string=hai) anos
pai
achega
3d3d3ef2d9
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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) && ...);
+    }
     }
 
     /**