group: extended_group_iterator::base to return the underlying iterator
This commit is contained in:
1
TODO
1
TODO
@@ -15,7 +15,6 @@ TODO (high prio):
|
||||
* check natvis files (periodically :)
|
||||
* remove the static storage from the const assure in the registry
|
||||
* pop_if to improve further destroying entities (drastically)
|
||||
* add iterator_type/base to extended storage iterators (group)
|
||||
|
||||
WIP:
|
||||
* get rid of observers, storage based views made them pointless - document alternatives
|
||||
|
||||
@@ -36,6 +36,7 @@ class extended_group_iterator<It, owned_t<Owned...>, get_t<Get...>> {
|
||||
}
|
||||
|
||||
public:
|
||||
using iterator_type = It;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = decltype(std::tuple_cat(std::make_tuple(*std::declval<It>()), std::declval<Owned>().get_as_tuple({})..., std::declval<Get>().get_as_tuple({})...));
|
||||
using pointer = input_iterator_pointer<value_type>;
|
||||
@@ -67,6 +68,10 @@ public:
|
||||
return operator*();
|
||||
}
|
||||
|
||||
constexpr iterator_type base() const noexcept {
|
||||
return it;
|
||||
}
|
||||
|
||||
template<typename... Lhs, typename... Rhs>
|
||||
friend constexpr bool operator==(const extended_group_iterator<Lhs...> &, const extended_group_iterator<Rhs...> &) noexcept;
|
||||
|
||||
|
||||
@@ -201,7 +201,9 @@ TEST(NonOwningGroup, Each) {
|
||||
|
||||
auto it = iterable.begin();
|
||||
|
||||
ASSERT_EQ(it.base(), group.begin());
|
||||
ASSERT_EQ((it++, ++it), iterable.end());
|
||||
ASSERT_EQ(it.base(), group.end());
|
||||
|
||||
group.each([expected = 1](auto entt, int &ivalue, char &cvalue) mutable {
|
||||
ASSERT_EQ(static_cast<int>(entt::to_integral(entt)), expected);
|
||||
@@ -875,7 +877,9 @@ TEST(OwningGroup, Each) {
|
||||
|
||||
auto it = iterable.begin();
|
||||
|
||||
ASSERT_EQ(it.base(), group.begin());
|
||||
ASSERT_EQ((it++, ++it), iterable.end());
|
||||
ASSERT_EQ(it.base(), group.end());
|
||||
|
||||
group.each([expected = 1](auto entt, int &ivalue, char &cvalue) mutable {
|
||||
ASSERT_EQ(static_cast<int>(entt::to_integral(entt)), expected);
|
||||
|
||||
Reference in New Issue
Block a user