group: minor changes

This commit is contained in:
Michele Caini
2023-03-29 18:32:19 +02:00
parent 77c59aabfa
commit fbfee632d5

View File

@@ -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:
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 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 {