From cd4bcce70f68800eb43a836bc3e73c19af335c9e Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 27 Dec 2019 01:43:05 +0100 Subject: [PATCH] view: faster contains --- src/entt/entity/view.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index db92a13fc..4e5654ab6 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -359,7 +359,8 @@ public: * @return True if the view contains the given entity, false otherwise. */ bool contains(const entity_type entt) const { - return find(entt) != end(); + return (std::get *>(pools)->has(entt) && ...) + && (!std::get *>(pools)->has(entt) && ...); } /** @@ -688,7 +689,7 @@ public: * @return True if the view contains the given entity, false otherwise. */ bool contains(const entity_type entt) const { - return find(entt) != end(); + return pool->has(entt); } /**