Просмотр исходного кода

view: use scoped iterators with ::contains

Michele Caini 2 лет назад
Родитель
Сommit
9d97c83909
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      src/entt/entity/view.hpp

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

@@ -474,7 +474,12 @@ public:
      * @return True if the view contains the given entity, false otherwise.
      */
     [[nodiscard]] bool contains(const entity_type entt) const noexcept {
-        return view && std::apply([entt](const auto *...curr) { return (curr->contains(entt) && ...); }, pools) && internal::none_of(filter, entt);
+        if (view) {
+            const auto idx = view->find(entt).index();
+            return (!(idx < 0 || idx > view->begin(0).index())) && internal::all_of(opaque_check_set(), entt) && internal::none_of(filter, entt);
+        }
+
+        return false;
     }
 
     /**