|
|
@@ -55,21 +55,10 @@ namespace entt {
|
|
|
*/
|
|
|
template<typename Entity>
|
|
|
class basic_runtime_view final {
|
|
|
- using underlying_iterator = typename basic_sparse_set<Entity>::iterator;
|
|
|
+ using basic_common_type = basic_sparse_set<Entity>;
|
|
|
+ using underlying_iterator = typename basic_common_type::iterator;
|
|
|
|
|
|
class view_iterator final {
|
|
|
- friend class basic_runtime_view<Entity>;
|
|
|
-
|
|
|
- view_iterator(const std::vector<const basic_sparse_set<Entity> *> &cpools, const std::vector<const basic_sparse_set<Entity> *> &ignore, underlying_iterator curr) ENTT_NOEXCEPT
|
|
|
- : pools{&cpools},
|
|
|
- filter{&ignore},
|
|
|
- it{curr}
|
|
|
- {
|
|
|
- if(it != (*pools)[0]->end() && !valid()) {
|
|
|
- ++(*this);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
[[nodiscard]] bool valid() const {
|
|
|
return std::all_of(pools->begin()++, pools->end(), [entt = *it](const auto *curr) { return curr->contains(entt); })
|
|
|
&& std::none_of(filter->cbegin(), filter->cend(), [entt = *it](const auto *curr) { return curr && curr->contains(entt); });
|
|
|
@@ -84,6 +73,16 @@ class basic_runtime_view final {
|
|
|
|
|
|
view_iterator() ENTT_NOEXCEPT = default;
|
|
|
|
|
|
+ view_iterator(const std::vector<const basic_common_type *> &cpools, const std::vector<const basic_common_type *> &ignore, underlying_iterator curr) ENTT_NOEXCEPT
|
|
|
+ : pools{&cpools},
|
|
|
+ filter{&ignore},
|
|
|
+ it{curr}
|
|
|
+ {
|
|
|
+ if(it != (*pools)[0]->end() && !valid()) {
|
|
|
+ ++(*this);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
view_iterator & operator++() {
|
|
|
while(++it != (*pools)[0]->end() && !valid());
|
|
|
return *this;
|
|
|
@@ -121,8 +120,8 @@ class basic_runtime_view final {
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
- const std::vector<const basic_sparse_set<Entity> *> *pools;
|
|
|
- const std::vector<const basic_sparse_set<Entity> *> *filter;
|
|
|
+ const std::vector<const basic_common_type *> *pools;
|
|
|
+ const std::vector<const basic_common_type *> *filter;
|
|
|
underlying_iterator it;
|
|
|
};
|
|
|
|
|
|
@@ -149,7 +148,7 @@ public:
|
|
|
* @param cpools The storage for the types to iterate.
|
|
|
* @param epools The storage for the types used to filter the view.
|
|
|
*/
|
|
|
- basic_runtime_view(std::vector<const basic_sparse_set<Entity> *> cpools, std::vector<const basic_sparse_set<Entity> *> epools) ENTT_NOEXCEPT
|
|
|
+ basic_runtime_view(std::vector<const basic_common_type *> cpools, std::vector<const basic_common_type *> epools) ENTT_NOEXCEPT
|
|
|
: pools{std::move(cpools)},
|
|
|
filter{std::move(epools)}
|
|
|
{
|
|
|
@@ -231,8 +230,8 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
- std::vector<const basic_sparse_set<Entity> *> pools;
|
|
|
- std::vector<const basic_sparse_set<Entity> *> filter;
|
|
|
+ std::vector<const basic_common_type *> pools;
|
|
|
+ std::vector<const basic_common_type *> filter;
|
|
|
};
|
|
|
|
|
|
|