From 559ee931fb74640be4e15915504f3046fabcd442 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 15 Oct 2020 10:06:00 +0200 Subject: [PATCH] view/group: proxy() -> each() (breaking changes - I know, I shouldn't have changed it before) --- docs/md/entity.md | 12 +++--- src/entt/entity/group.hpp | 60 +++++++++++++++--------------- src/entt/entity/view.hpp | 76 +++++++++++++++++++------------------- test/entt/entity/group.cpp | 40 ++++++++++---------- test/entt/entity/view.cpp | 44 +++++++++++----------- 5 files changed, 116 insertions(+), 116 deletions(-) diff --git a/docs/md/entity.md b/docs/md/entity.md index 7702f92d8..e1cd1fb82 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -1357,8 +1357,8 @@ for(auto entity: view) { } ``` -Or rely on the `each` and `proxy` member functions to iterate both entities and -components at once: +Or rely on the `each` member functions to iterate both entities and components +at once: ```cpp // through a callback @@ -1367,7 +1367,7 @@ registry.view().each([](auto entity, auto &pos, auto &vel) { }); // using an input iterator -for(auto &&[entity, pos, vel]: registry.view().proxy()) { +for(auto &&[entity, pos, vel]: registry.view().each()) { // ... } ``` @@ -1518,8 +1518,8 @@ for(auto entity: group) { } ``` -Or rely on the `each` and `proxy` member functions to iterate both entities and -components at once: +Or rely on the `each` member functions to iterate both entities and components +at once: ```cpp // through a callback @@ -1528,7 +1528,7 @@ registry.group(entt::get).each([](auto entity, auto &pos, au }); // using an input iterator -for(auto &&[entity, pos, vel]: registry.group(entt::get).proxy()) { +for(auto &&[entity, pos, vel]: registry.group(entt::get).each()) { // ... } ``` diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index c1aa97c78..a66195b3f 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -71,16 +71,16 @@ class basic_group, get_t> final { template using pool_type = pool_t; - class group_proxy { + class iterable_group { friend class basic_group, get_t>; - class proxy_iterator { - friend class group_proxy; + class iterable_group_iterator { + friend class iterable_group; using it_type = typename basic_sparse_set::iterator; using ref_type = decltype(std::tuple_cat(std::declval, std::tuple<>, std::tuple *>>>()...)); - proxy_iterator(it_type from, ref_type ref) ENTT_NOEXCEPT + iterable_group_iterator(it_type from, ref_type ref) ENTT_NOEXCEPT : it{from}, pools{ref} {} @@ -98,12 +98,12 @@ class basic_group, get_t> final { )); using iterator_category = std::input_iterator_tag; - proxy_iterator & operator++() ENTT_NOEXCEPT { + iterable_group_iterator & operator++() ENTT_NOEXCEPT { return ++it, *this; } - proxy_iterator operator++(int) ENTT_NOEXCEPT { - proxy_iterator orig = *this; + iterable_group_iterator operator++(int) ENTT_NOEXCEPT { + iterable_group_iterator orig = *this; return ++(*this), orig; } @@ -111,11 +111,11 @@ class basic_group, get_t> final { return std::apply([entt = *it](auto *... cpool) { return reference{entt, cpool->get(entt)...}; }, pools); } - [[nodiscard]] bool operator==(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator==(const iterable_group_iterator &other) const ENTT_NOEXCEPT { return other.it == it; } - [[nodiscard]] bool operator!=(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator!=(const iterable_group_iterator &other) const ENTT_NOEXCEPT { return !(*this == other); } @@ -124,16 +124,16 @@ class basic_group, get_t> final { ref_type pools{}; }; - group_proxy(const basic_sparse_set &ref, std::tuple *...> gpools) + iterable_group(const basic_sparse_set &ref, std::tuple *...> gpools) : handler{&ref}, pools{gpools} {} public: - using iterator = proxy_iterator; + using iterator = iterable_group_iterator; [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { - return proxy_iterator{handler->begin(), std::tuple_cat([](auto *cpool) { + return iterable_group_iterator{handler->begin(), std::tuple_cat([](auto *cpool) { if constexpr(is_eto_eligible_v::value_type>) { return std::make_tuple(); } else { @@ -143,7 +143,7 @@ class basic_group, get_t> final { } [[nodiscard]] iterator end() const ENTT_NOEXCEPT { - return proxy_iterator{handler->end(), std::tuple_cat([](auto *cpool) { + return iterable_group_iterator{handler->end(), std::tuple_cat([](auto *cpool) { if constexpr(is_eto_eligible_v::value_type>) { return std::make_tuple(); } else { @@ -469,8 +469,8 @@ public: * * @return An iterable object to use to _visit_ the group. */ - [[nodiscard]] auto proxy() const ENTT_NOEXCEPT { - return group_proxy{*handler, pools}; + [[nodiscard]] auto each() const ENTT_NOEXCEPT { + return iterable_group{*handler, pools}; } /** @@ -609,17 +609,17 @@ class basic_group, get_t, Owned...> final template using component_iterator = decltype(std::declval>().begin()); - class group_proxy { + class iterable_group { friend class basic_group, get_t, Owned...>; - class proxy_iterator { - friend class group_proxy; + class iterable_group_iterator { + friend class iterable_group; using it_type = typename basic_sparse_set::iterator; using owned_type = decltype(std::tuple_cat(std::declval, std::tuple<>, std::tuple>>>()...)); using get_type = decltype(std::tuple_cat(std::declval, std::tuple<>, std::tuple *>>>()...)); - proxy_iterator(it_type from, owned_type oref, get_type gref) ENTT_NOEXCEPT + iterable_group_iterator(it_type from, owned_type oref, get_type gref) ENTT_NOEXCEPT : it{from}, owned{oref}, get{gref} @@ -640,12 +640,12 @@ class basic_group, get_t, Owned...> final )); using iterator_category = std::input_iterator_tag; - proxy_iterator & operator++() ENTT_NOEXCEPT { + iterable_group_iterator & operator++() ENTT_NOEXCEPT { return ++it, std::apply([](auto &&... curr) { (++curr, ...); }, owned), *this; } - proxy_iterator operator++(int) ENTT_NOEXCEPT { - proxy_iterator orig = *this; + iterable_group_iterator operator++(int) ENTT_NOEXCEPT { + iterable_group_iterator orig = *this; return ++(*this), orig; } @@ -657,11 +657,11 @@ class basic_group, get_t, Owned...> final ); } - [[nodiscard]] bool operator==(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator==(const iterable_group_iterator &other) const ENTT_NOEXCEPT { return other.it == it; } - [[nodiscard]] bool operator!=(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator!=(const iterable_group_iterator &other) const ENTT_NOEXCEPT { return !(*this == other); } @@ -671,16 +671,16 @@ class basic_group, get_t, Owned...> final get_type get{}; }; - group_proxy(std::tuple *..., pool_type *...> cpools, const std::size_t &extent) + iterable_group(std::tuple *..., pool_type *...> cpools, const std::size_t &extent) : pools{cpools}, length{&extent} {} public: - using iterator = proxy_iterator; + using iterator = iterable_group_iterator; [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { - return proxy_iterator{ + return iterable_group_iterator{ std::get<0>(pools)->basic_sparse_set::end() - *length, std::tuple_cat([length = *length](auto *cpool) { if constexpr(is_eto_eligible_v::value_type>) { @@ -700,7 +700,7 @@ class basic_group, get_t, Owned...> final } [[nodiscard]] iterator end() const ENTT_NOEXCEPT { - return proxy_iterator{ + return iterable_group_iterator{ std::get<0>(pools)->basic_sparse_set::end(), std::tuple_cat([](auto *cpool) { if constexpr(is_eto_eligible_v::value_type>) { @@ -1039,8 +1039,8 @@ public: * * @return An iterable object to use to _visit_ the group. */ - [[nodiscard]] auto proxy() const ENTT_NOEXCEPT { - return group_proxy{pools, *length}; + [[nodiscard]] auto each() const ENTT_NOEXCEPT { + return iterable_group{pools, *length}; } /** diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 5df8e7852..a2fe29af0 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -151,17 +151,17 @@ class basic_view, Component...> final { filter_type filter; }; - class view_proxy { + class iterable_view { friend class basic_view, Component...>; - using proxy_view_iterator = view_iterator::iterator>; + using underlying_iterator = view_iterator::iterator>; - class proxy_iterator { - friend class view_proxy; + class iterable_view_iterator { + friend class iterable_view; using ref_type = decltype(std::tuple_cat(std::declval, std::tuple<>, std::tuple *>>>()...)); - proxy_iterator(proxy_view_iterator from, ref_type ref) ENTT_NOEXCEPT + iterable_view_iterator(underlying_iterator from, ref_type ref) ENTT_NOEXCEPT : it{from}, pools{ref} {} @@ -176,12 +176,12 @@ class basic_view, Component...> final { using reference = value_type; using iterator_category = std::input_iterator_tag; - proxy_iterator & operator++() ENTT_NOEXCEPT { + iterable_view_iterator & operator++() ENTT_NOEXCEPT { return ++it, *this; } - proxy_iterator operator++(int) ENTT_NOEXCEPT { - proxy_iterator orig = *this; + iterable_view_iterator operator++(int) ENTT_NOEXCEPT { + iterable_view_iterator orig = *this; return ++(*this), orig; } @@ -189,30 +189,30 @@ class basic_view, Component...> final { return std::apply([entt = *it](auto *... cpool) { return reference{entt, cpool->get(entt)...}; }, pools); } - [[nodiscard]] bool operator==(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator==(const iterable_view_iterator &other) const ENTT_NOEXCEPT { return other.it == it; } - [[nodiscard]] bool operator!=(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator!=(const iterable_view_iterator &other) const ENTT_NOEXCEPT { return !(*this == other); } private: - proxy_view_iterator it{}; + underlying_iterator it{}; const ref_type pools{}; }; - view_proxy(proxy_view_iterator from, proxy_view_iterator to, std::tuple *...> ref) + iterable_view(underlying_iterator from, underlying_iterator to, std::tuple *...> ref) : first{from}, last{to}, pools{ref} {} public: - using iterator = proxy_iterator; + using iterator = iterable_view_iterator; [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { - return proxy_iterator{first, std::tuple_cat([](auto *cpool) { + return iterable_view_iterator{first, std::tuple_cat([](auto *cpool) { if constexpr(is_eto_eligible_v::value_type>) { return std::make_tuple(); } else { @@ -222,7 +222,7 @@ class basic_view, Component...> final { } [[nodiscard]] iterator end() const ENTT_NOEXCEPT { - return proxy_iterator{last, std::tuple_cat([](auto *cpool) { + return iterable_view_iterator{last, std::tuple_cat([](auto *cpool) { if constexpr(is_eto_eligible_v::value_type>) { return std::make_tuple(); } else { @@ -232,8 +232,8 @@ class basic_view, Component...> final { } private: - proxy_view_iterator first; - proxy_view_iterator last; + underlying_iterator first; + underlying_iterator last; const std::tuple *...> pools; }; @@ -545,9 +545,9 @@ public: * * @return An iterable object to use to _visit_ the view. */ - [[nodiscard]] auto proxy() const ENTT_NOEXCEPT { + [[nodiscard]] auto each() const ENTT_NOEXCEPT { view = candidate(); - return view_proxy{begin(), end(), pools}; + return iterable_view{begin(), end(), pools}; } /** @@ -565,11 +565,11 @@ public: * @return An iterable object to use to _visit_ the view. */ template - [[nodiscard]] auto proxy() const ENTT_NOEXCEPT { + [[nodiscard]] auto each() const ENTT_NOEXCEPT { const basic_sparse_set *cpool = std::get *>(pools); iterator first{cpool->begin(), cpool->end(), cpool->begin(), unchecked(cpool), filter}; iterator last{cpool->begin(), cpool->end(), cpool->end(), unchecked(cpool), filter}; - return view_proxy{std::move(first), std::move(last), pools}; + return iterable_view{std::move(first), std::move(last), pools}; } /** @@ -656,11 +656,11 @@ class basic_view, Component> final { using pool_type = pool_t; - class view_proxy { + class iterable_view { friend class basic_view, Component>; - class proxy_iterator { - friend class view_proxy; + class iterable_view_iterator { + friend class iterable_view; using it_type = std::conditional_t< is_eto_eligible_v, @@ -668,7 +668,7 @@ class basic_view, Component> final { std::tuple::iterator, decltype(std::declval().begin())> >; - proxy_iterator(it_type from) ENTT_NOEXCEPT + iterable_view_iterator(it_type from) ENTT_NOEXCEPT : it{from} {} @@ -679,12 +679,12 @@ class basic_view, Component> final { using reference = value_type; using iterator_category = std::input_iterator_tag; - proxy_iterator & operator++() ENTT_NOEXCEPT { + iterable_view_iterator & operator++() ENTT_NOEXCEPT { return std::apply([](auto &&... curr) { (++curr, ...); }, it), *this; } - proxy_iterator operator++(int) ENTT_NOEXCEPT { - proxy_iterator orig = *this; + iterable_view_iterator operator++(int) ENTT_NOEXCEPT { + iterable_view_iterator orig = *this; return ++(*this), orig; } @@ -692,11 +692,11 @@ class basic_view, Component> final { return std::apply([](auto &&... curr) { return reference{*curr...}; }, it); } - [[nodiscard]] bool operator==(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator==(const iterable_view_iterator &other) const ENTT_NOEXCEPT { return std::get<0>(other.it) == std::get<0>(it); } - [[nodiscard]] bool operator!=(const proxy_iterator &other) const ENTT_NOEXCEPT { + [[nodiscard]] bool operator!=(const iterable_view_iterator &other) const ENTT_NOEXCEPT { return !(*this == other); } @@ -704,26 +704,26 @@ class basic_view, Component> final { it_type it{}; }; - view_proxy(pool_type &ref) + iterable_view(pool_type &ref) : pool{&ref} {} public: - using iterator = proxy_iterator; + using iterator = iterable_view_iterator; [[nodiscard]] iterator begin() const ENTT_NOEXCEPT { if constexpr(is_eto_eligible_v) { - return proxy_iterator{std::make_tuple(pool->basic_sparse_set::begin())}; + return iterable_view_iterator{std::make_tuple(pool->basic_sparse_set::begin())}; } else { - return proxy_iterator{std::make_tuple(pool->basic_sparse_set::begin(), pool->begin())}; + return iterable_view_iterator{std::make_tuple(pool->basic_sparse_set::begin(), pool->begin())}; } } [[nodiscard]] iterator end() const ENTT_NOEXCEPT { if constexpr(is_eto_eligible_v) { - return proxy_iterator{std::make_tuple(pool->basic_sparse_set::end())}; + return iterable_view_iterator{std::make_tuple(pool->basic_sparse_set::end())}; } else { - return proxy_iterator{std::make_tuple(pool->basic_sparse_set::end(), pool->end())}; + return iterable_view_iterator{std::make_tuple(pool->basic_sparse_set::end(), pool->end())}; } } @@ -996,8 +996,8 @@ public: * * @return An iterable object to use to _visit_ the view. */ - [[nodiscard]] auto proxy() const ENTT_NOEXCEPT { - return view_proxy{*pool}; + [[nodiscard]] auto each() const ENTT_NOEXCEPT { + return iterable_view{*pool}; } private: diff --git a/test/entt/entity/group.cpp b/test/entt/entity/group.cpp index 0c4cba6e1..ae76d4fb1 100644 --- a/test/entt/entity/group.cpp +++ b/test/entt/entity/group.cpp @@ -146,7 +146,7 @@ TEST(NonOwningGroup, Empty) { ASSERT_TRUE(registry.group(entt::get).empty()); } -TEST(NonOwningGroup, EachAndProxy) { +TEST(NonOwningGroup, Each) { entt::registry registry; auto group = registry.group(entt::get); @@ -164,7 +164,7 @@ TEST(NonOwningGroup, EachAndProxy) { group.each([&cnt](auto, int &, char &) { ++cnt; }); group.each([&cnt](int &, char &) { ++cnt; }); - for(auto &&[entt, iv, cv]: group.proxy()) { + for(auto &&[entt, iv, cv]: group.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -176,7 +176,7 @@ TEST(NonOwningGroup, EachAndProxy) { cgroup.each([&cnt](auto, const int &, const char &) { --cnt; }); cgroup.each([&cnt](const int &, const char &) { --cnt; }); - for(auto &&[entt, iv, cv]: cgroup.proxy()) { + for(auto &&[entt, iv, cv]: cgroup.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -321,7 +321,7 @@ TEST(NonOwningGroup, IndexRebuiltOnDestroy) { ASSERT_EQ(uivalue, 1u); }); - for(auto &&curr: group.proxy()) { + for(auto &&curr: group.each()) { ASSERT_EQ(std::get<0>(curr), e1); ASSERT_EQ(std::get<1>(curr), 1); ASSERT_EQ(std::get<2>(curr), 1u); @@ -351,7 +351,7 @@ TEST(NonOwningGroup, ConstNonConstAndAllInBetween) { static_assert(std::is_same_v); }); - for(auto &&[entt, iv, cv]: group.proxy()) { + for(auto &&[entt, iv, cv]: group.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -473,7 +473,7 @@ TEST(NonOwningGroup, EmptyAndNonEmptyTypes) { ASSERT_TRUE(entity == e0 || entity == e1); }); - for(auto &&[entt, iv]: group.proxy()) { + for(auto &&[entt, iv]: group.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); ASSERT_TRUE(entt == e0 || entt == e1); @@ -512,7 +512,7 @@ TEST(NonOwningGroup, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.group(entt::get).proxy()) { + for(auto &&[entt, iv, cv]: registry.group(entt::get).each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -524,7 +524,7 @@ TEST(NonOwningGroup, EmptyTypes) { check = false; }); - for(auto &&[entt, iv, cv]: registry.group(entt::get).proxy()) { + for(auto &&[entt, iv, cv]: registry.group(entt::get).each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -535,7 +535,7 @@ TEST(NonOwningGroup, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.group(entt::get).proxy()) { + for(auto &&[entt, iv, cv]: registry.group(entt::get).each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -543,7 +543,7 @@ TEST(NonOwningGroup, EmptyTypes) { } registry.group(entt::get).each([](const auto, int, char, double) { FAIL(); }); - ASSERT_EQ(registry.group(entt::get).proxy().begin(), registry.group(entt::get).proxy().end()); + ASSERT_EQ(registry.group(entt::get).each().begin(), registry.group(entt::get).each().end()); } TEST(NonOwningGroup, FrontBack) { @@ -709,7 +709,7 @@ TEST(OwningGroup, Empty) { ASSERT_TRUE((registry.group(entt::get).empty())); } -TEST(OwningGroup, EachAndProxy) { +TEST(OwningGroup, Each) { entt::registry registry; auto group = registry.group(entt::get); @@ -727,7 +727,7 @@ TEST(OwningGroup, EachAndProxy) { group.each([&cnt](auto, int &, char &) { ++cnt; }); group.each([&cnt](int &, char &) { ++cnt; }); - for(auto &&[entt, iv, cv]: group.proxy()) { + for(auto &&[entt, iv, cv]: group.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -739,7 +739,7 @@ TEST(OwningGroup, EachAndProxy) { cgroup.each([&cnt](auto, const int &, const char &) { --cnt; }); cgroup.each([&cnt](const int &, const char &) { --cnt; }); - for(auto &&[entt, iv, cv]: cgroup.proxy()) { + for(auto &&[entt, iv, cv]: cgroup.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -968,7 +968,7 @@ TEST(OwningGroup, IndexRebuiltOnDestroy) { ASSERT_EQ(uivalue, 1u); }); - for(auto &&curr: group.proxy()) { + for(auto &&curr: group.each()) { ASSERT_EQ(std::get<0>(curr), e1); ASSERT_EQ(std::get<1>(curr), 1); ASSERT_EQ(std::get<2>(curr), 1u); @@ -1006,7 +1006,7 @@ TEST(OwningGroup, ConstNonConstAndAllInBetween) { static_assert(std::is_same_v); }); - for(auto &&[entt, iv, cv, dv, fv]: group.proxy()) { + for(auto &&[entt, iv, cv, dv, fv]: group.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -1130,7 +1130,7 @@ TEST(OwningGroup, EmptyAndNonEmptyTypes) { ASSERT_TRUE(entity == e0 || entity == e1); }); - for(auto &&[entt, iv]: group.proxy()) { + for(auto &&[entt, iv]: group.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); ASSERT_TRUE(entt == e0 || entt == e1); @@ -1169,7 +1169,7 @@ TEST(OwningGroup, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.group(entt::get).proxy()) { + for(auto &&[entt, iv, cv]: registry.group(entt::get).each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -1181,7 +1181,7 @@ TEST(OwningGroup, EmptyTypes) { check = false; }); - for(auto &&[entt, cv, iv]: registry.group(entt::get).proxy()) { + for(auto &&[entt, cv, iv]: registry.group(entt::get).each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -1192,7 +1192,7 @@ TEST(OwningGroup, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.group(entt::get).proxy()) { + for(auto &&[entt, iv, cv]: registry.group(entt::get).each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -1200,7 +1200,7 @@ TEST(OwningGroup, EmptyTypes) { } registry.group(entt::get).each([](const auto, double, int, char) { FAIL(); }); - ASSERT_EQ(registry.group(entt::get).proxy().begin(), registry.group(entt::get).proxy().end()); + ASSERT_EQ(registry.group(entt::get).each().begin(), registry.group(entt::get).each().end()); } TEST(OwningGroup, FrontBack) { diff --git a/test/entt/entity/view.cpp b/test/entt/entity/view.cpp index 8e3b2e4e2..ce5e16e45 100644 --- a/test/entt/entity/view.cpp +++ b/test/entt/entity/view.cpp @@ -107,7 +107,7 @@ TEST(SingleComponentView, Empty) { ASSERT_EQ(view.rbegin(), view.rend()); } -TEST(SingleComponentView, EachAndProxy) { +TEST(SingleComponentView, Each) { entt::registry registry; registry.emplace(registry.create()); @@ -120,7 +120,7 @@ TEST(SingleComponentView, EachAndProxy) { view.each([&cnt](auto, int &) { ++cnt; }); view.each([&cnt](int &) { ++cnt; }); - for(auto &&[entt, iv]: view.proxy()) { + for(auto &&[entt, iv]: view.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); ++cnt; @@ -131,7 +131,7 @@ TEST(SingleComponentView, EachAndProxy) { cview.each([&cnt](auto, const int &) { --cnt; }); cview.each([&cnt](const int &) { --cnt; }); - for(auto &&[entt, iv]: cview.proxy()) { + for(auto &&[entt, iv]: cview.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); --cnt; @@ -169,12 +169,12 @@ TEST(SingleComponentView, ConstNonConstAndAllInBetween) { static_assert(std::is_same_v); }); - for(auto &&[entt, iv]: view.proxy()) { + for(auto &&[entt, iv]: view.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); } - for(auto &&[entt, iv]: cview.proxy()) { + for(auto &&[entt, iv]: cview.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); } @@ -240,7 +240,7 @@ TEST(SingleComponentView, EmptyTypes) { check = false; }); - for(auto &&[entt]: registry.view().proxy()) { + for(auto &&[entt]: registry.view().each()) { static_assert(std::is_same_v); ASSERT_EQ(entity, entt); } @@ -254,7 +254,7 @@ TEST(SingleComponentView, EmptyTypes) { check = false; }); - for(auto &&[entt, iv]: registry.view().proxy()) { + for(auto &&[entt, iv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); ASSERT_EQ(entity, entt); @@ -411,7 +411,7 @@ TEST(MultiComponentView, Empty) { ASSERT_EQ(view.rbegin(), view.rend()); } -TEST(MultiComponentView, EachAndProxy) { +TEST(MultiComponentView, Each) { entt::registry registry; const auto e0 = registry.create(); @@ -429,7 +429,7 @@ TEST(MultiComponentView, EachAndProxy) { view.each([&cnt](auto, int &, char &) { ++cnt; }); view.each([&cnt](int &, char &) { ++cnt; }); - for(auto &&[entt, iv, cv]: view.proxy()) { + for(auto &&[entt, iv, cv]: view.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -441,7 +441,7 @@ TEST(MultiComponentView, EachAndProxy) { cview.each([&cnt](auto, const int &, const char &) { --cnt; }); cview.each([&cnt](const int &, const char &) { --cnt; }); - for(auto &&[entt, iv, cv]: cview.proxy()) { + for(auto &&[entt, iv, cv]: cview.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -451,7 +451,7 @@ TEST(MultiComponentView, EachAndProxy) { ASSERT_EQ(cnt, std::size_t{0}); } -TEST(MultiComponentView, EachAndProxyWithSuggestedType) { +TEST(MultiComponentView, EachWithSuggestedType) { entt::registry registry; for(auto i = 0; i < 3; ++i) { @@ -482,7 +482,7 @@ TEST(MultiComponentView, EachAndProxyWithSuggestedType) { auto value = registry.view().size_hint(); - for(auto &&curr: registry.view().proxy()) { + for(auto &&curr: registry.view().each()) { ASSERT_EQ(std::get<1>(curr), static_cast(--value)); } @@ -492,12 +492,12 @@ TEST(MultiComponentView, EachAndProxyWithSuggestedType) { value = {}; - for(auto &&curr: registry.view().proxy()) { + for(auto &&curr: registry.view().each()) { ASSERT_EQ(std::get<1>(curr), static_cast(value++)); } } -TEST(MultiComponentView, EachAndProxyWithHoles) { +TEST(MultiComponentView, EachWithHoles) { entt::registry registry; const auto e0 = registry.create(); @@ -518,7 +518,7 @@ TEST(MultiComponentView, EachAndProxyWithHoles) { ASSERT_EQ(i, 0); }); - for(auto &&curr: view.proxy()) { + for(auto &&curr: view.each()) { ASSERT_EQ(std::get<0>(curr), e0); ASSERT_EQ(std::get<1>(curr), '0'); ASSERT_EQ(std::get<2>(curr), 0); @@ -546,7 +546,7 @@ TEST(MultiComponentView, ConstNonConstAndAllInBetween) { static_assert(std::is_same_v); }); - for(auto &&[entt, iv, cv]: view.proxy()) { + for(auto &&[entt, iv, cv]: view.each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -660,7 +660,7 @@ TEST(MultiComponentView, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.view().proxy()) { + for(auto &&[entt, iv, cv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -672,7 +672,7 @@ TEST(MultiComponentView, EmptyTypes) { check = false; }); - for(auto &&[entt, iv, cv]: registry.view().proxy()) { + for(auto &&[entt, iv, cv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -683,7 +683,7 @@ TEST(MultiComponentView, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.view().proxy()) { + for(auto &&[entt, iv, cv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -694,7 +694,7 @@ TEST(MultiComponentView, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv]: registry.view().proxy()) { + for(auto &&[entt, iv, cv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -706,7 +706,7 @@ TEST(MultiComponentView, EmptyTypes) { check = false; }); - for(auto &&[entt, iv, cv]: registry.view().proxy()) { + for(auto &&[entt, iv, cv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); @@ -717,7 +717,7 @@ TEST(MultiComponentView, EmptyTypes) { ASSERT_EQ(entity, entt); }); - for(auto &&[entt, iv, cv, dv]: registry.view().proxy()) { + for(auto &&[entt, iv, cv, dv]: registry.view().each()) { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v);