Browse Source

view: reduce the number of symbols

Michele Caini 3 years ago
parent
commit
0952f3ce03
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/entt/entity/view.hpp

+ 5 - 3
src/entt/entity/view.hpp

@@ -215,14 +215,16 @@ class basic_view<get_t<Get...>, exclude_t<Exclude...>> {
         }
     }
 
+    [[nodiscard]] auto reject(const underlying_type entt) const noexcept {
+        return std::apply([entt](const auto *...curr) { return (curr->contains(entt) || ...); }, filter);
+    }
+
     template<std::size_t Curr, typename Func, std::size_t... Index>
     void each(Func func, std::index_sequence<Index...>) const {
         for(const auto curr: storage<Curr>().each()) {
             const auto entt = std::get<0>(curr);
 
-            if(((sizeof...(Get) != 1u) || (entt != tombstone))
-               && ((Curr == Index || storage<Index>().contains(entt)) && ...)
-               && std::apply([entt](const auto *...epool) { return (!epool->contains(entt) && ...); }, filter)) {
+            if(((sizeof...(Get) != 1u) || (entt != tombstone)) && ((Curr == Index || storage<Index>().contains(entt)) && ...) && !reject(entt)) {
                 if constexpr(is_applicable_v<Func, decltype(std::tuple_cat(std::tuple<entity_type>{}, std::declval<basic_view>().get({})))>) {
                     std::apply(func, std::tuple_cat(std::make_tuple(entt), dispatch_get<Curr, Index>(curr)...));
                 } else {