Michele Caini преди 3 години
родител
ревизия
fbfee632d5
променени са 1 файла, в които са добавени 12 реда и са изтрити 15 реда
  1. 12 15
      src/entt/entity/group.hpp

+ 12 - 15
src/entt/entity/group.hpp

@@ -136,6 +136,17 @@ class group_handler<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> fin
         }
         }
     }
     }
 
 
+    template<typename... Type>
+    auto check(const id_type *elem, const typename owning_group_descriptor::size_type len) const noexcept {
+        size_type cnt = 0u;
+
+        for(auto pos = 0u; pos < len; ++pos) {
+            cnt += ((elem[pos] == entt::type_hash<typename Type::value_type>::value()) || ...);
+        }
+
+        return cnt;
+    }
+
 public:
 public:
     using size_type = typename owning_group_descriptor::size_type;
     using size_type = typename owning_group_descriptor::size_type;
 
 
@@ -153,21 +164,7 @@ public:
     }
     }
 
 
     size_type check(const id_type *elem, const size_type olen, const size_type glen, const size_type elen) const noexcept final {
     size_type check(const id_type *elem, const size_type olen, const size_type glen, const size_type elen) const noexcept final {
-        size_type cnt = 0u;
-
-        for(auto pos = 0u; pos < olen; ++pos) {
-            cnt += ((elem[pos] == entt::type_hash<typename Owned::value_type>::value()) || ...);
-        }
-
-        for(auto pos = 0u; pos < glen; ++pos) {
-            cnt += ((elem[olen + pos] == entt::type_hash<typename Get::value_type>::value()) || ...);
-        }
-
-        for(auto pos = 0u; pos < elen; ++pos) {
-            cnt += ((elem[olen + glen + pos] == entt::type_hash<typename Exclude::value_type>::value()) || ...);
-        }
-
-        return cnt;
+        return check<Owned...>(elem, olen) + check<Get...>(elem + olen, glen) + check<Exclude...>(elem + olen + glen, elen);
     }
     }
 
 
     size_type size() const noexcept final {
     size_type size() const noexcept final {