7#include "../macros.hpp"
19template<
typename ParentIt>
22 using child_iterator = std::conditional_t<
23 std::is_const_v<std::remove_reference_t<typename std::iterator_traits<ParentIt>::reference>>,
88 return _parent_it == _parent_it_end;
106 constexpr recursive_iterator& operator++()
noexcept
109 if (_child_it ==
std::end(*_parent_it)) {
112 _child_it = _parent_it->begin();
118 constexpr recursive_iterator& operator--()
noexcept
128 constexpr recursive_iterator operator++(
int)
noexcept
135 constexpr recursive_iterator operator--(
int)
noexcept
142 constexpr recursive_iterator& operator+=(difference_type rhs)
noexcept
145 return (*
this) -= -rhs;
168 constexpr recursive_iterator& operator-=(difference_type rhs)
noexcept
171 return (*
this) += -rhs;
179 _child_it =
std::end(*_parent_it) - 1;
192 [[
nodiscard]]
constexpr friend bool operator==(recursive_iterator
const& lhs, recursive_iterator
const& rhs)
noexcept
194 if (lhs._parent_it != rhs._parent_it) {
196 }
else if (lhs.at_end()) {
197 hi_axiom(rhs.at_end());
200 return lhs._child_it == rhs._child_it;
204 [[
nodiscard]]
constexpr friend std::strong_ordering
205 operator<=>(recursive_iterator
const& lhs, recursive_iterator
const& rhs)
noexcept
207 if (lhs._parent_it != rhs._parent_it) {
208 return (lhs._parent_it - rhs._parent_it) <=> 0;
209 }
else if (lhs.at_end()) {
210 hi_axiom(rhs.at_end());
211 return std::strong_ordering::equal;
213 return (lhs._child_it - rhs._child_it) <=> 0;
217 [[
nodiscard]]
constexpr friend recursive_iterator operator+(recursive_iterator lhs, difference_type rhs)
noexcept
221 [[
nodiscard]]
constexpr friend recursive_iterator operator-(recursive_iterator lhs, difference_type rhs)
noexcept
225 [[
nodiscard]]
constexpr friend recursive_iterator operator+(difference_type lhs, recursive_iterator rhs)
noexcept
230 [[
nodiscard]]
constexpr friend difference_type
231 operator-(recursive_iterator
const& lhs, recursive_iterator
const& rhs)
noexcept
237 difference_type
count = 0;
238 while (
lhs_._parent_it < rhs._parent_it) {
248 parent_iterator _parent_it;
249 parent_iterator _parent_it_end;
250 child_iterator _child_it;
255template<
typename Container>
263template<
typename Container>
271template<
typename Container>
279template<
typename Container>
@ end
Start from the end of the file.
@ begin
Start from the beginning of the file.
@ other
The gui_event does not have associated data.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr auto recursive_iterator_begin(Container &rhs) noexcept
Get a recursive iterator from the begin of a recursive container.
Definition recursive_iterator.hpp:256
constexpr auto recursive_iterator_end(Container &rhs) noexcept
Get a recursive iterator from one beyond the end of a recursive container.
Definition recursive_iterator.hpp:264
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
An iterator which recursively iterates through nested containers.
Definition recursive_iterator.hpp:20
constexpr child_iterator child() const noexcept
Get the current child iterator.
Definition recursive_iterator.hpp:73
constexpr recursive_iterator(parent_iterator parent_it, parent_iterator parent_it_end, child_iterator child_it) noexcept
Create an iterator at an element inside a child container.
Definition recursive_iterator.hpp:42
constexpr bool at_end() const noexcept
Check if the iterator is at end.
Definition recursive_iterator.hpp:86
constexpr recursive_iterator(parent_iterator parent_it_end) noexcept
Create an end iterator one beyond the last child.
Definition recursive_iterator.hpp:58
constexpr recursive_iterator(parent_iterator parent_it, parent_iterator parent_it_end) noexcept
Create a begin iterator at the first child's first element.
Definition recursive_iterator.hpp:49
constexpr parent_iterator parent() const noexcept
Get the current parent iterator.
Definition recursive_iterator.hpp:65
Definition concepts.hpp:42