From 6a560fc7bfe5f4bf0201118641d5dd9809bac6d3 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 5 Mar 2020 23:53:27 +0100 Subject: [PATCH] observer: use any rather than a fold expression with has --- TODO | 1 - src/entt/entity/observer.hpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index dff335fa1..16492a641 100644 --- a/TODO +++ b/TODO @@ -16,7 +16,6 @@ * any-of rule for views/groups (eg entity has A and any of B/C/D) - get -> all, exclude -> none * review prepare after clone and the others have been removed -* !(has(e) || ...) -> !any(e) * review pool::remove, ::assign * WIP: diff --git a/src/entt/entity/observer.hpp b/src/entt/entity/observer.hpp index e16f42b99..5d1695ea9 100644 --- a/src/entt/entity/observer.hpp +++ b/src/entt/entity/observer.hpp @@ -177,7 +177,7 @@ class basic_observer { struct matcher_handler, type_list, AnyOf>> { template static void maybe_valid_if(basic_observer &obs, const basic_registry ®, const Entity entt) { - if(reg.template has(entt) && !(reg.template has(entt) || ...)) { + if(reg.template has(entt) && !reg.template any(entt)) { if(auto *comp = obs.view.try_get(entt); !comp) { obs.view.construct(entt); } @@ -213,7 +213,7 @@ class basic_observer { struct matcher_handler, type_list, type_list, AllOf...>> { template static void maybe_valid_if(basic_observer &obs, const basic_registry ®, const Entity entt) { - if(reg.template has(entt) && !(reg.template has(entt) || ...) && !(reg.template has(entt) || ...)) { + if(reg.template has(entt) && !reg.template any(entt)) { if(auto *comp = obs.view.try_get(entt); !comp) { obs.view.construct(entt); }