HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
hi::v1::recursive_iterator< ParentIt > Class Template Reference

#include <hikogui/algorithm/recursive_iterator.hpp>

Public Member Functions

constexpr recursive_iterator (recursive_iterator const &other) noexcept=default
constexpr recursive_iterator (recursive_iterator &&other) noexcept=default
constexpr recursive_iterator & operator= (recursive_iterator const &other) noexcept=default
constexpr recursive_iterator & operator= (recursive_iterator &&other) noexcept=default
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.
constexpr recursive_iterator (parent_iterator parent_it, parent_iterator parent_it_end) noexcept
 Create a begin iterator at the first child's first element.
constexpr recursive_iterator (parent_iterator parent_it_end) noexcept
 Create an end iterator one beyond the last child.
constexpr parent_iterator parent () const noexcept
 Get the current parent iterator.
constexpr child_iterator child () const noexcept
 Get the current child iterator.
constexpr bool at_end () const noexcept
 Check if the iterator is at end.
constexpr reference operator* () const noexcept
constexpr pointer operator-> () const noexcept
constexpr reference operator[] (std::size_t i) const noexcept
constexpr recursive_iterator & operator++ () noexcept
constexpr recursive_iterator & operator-- () noexcept
constexpr recursive_iterator operator++ (int) noexcept
constexpr recursive_iterator operator-- (int) noexcept
constexpr recursive_iterator & operator+= (difference_type rhs) noexcept
constexpr recursive_iterator & operator-= (difference_type rhs) noexcept

Friends

constexpr friend bool operator== (recursive_iterator const &lhs, recursive_iterator const &rhs) noexcept
constexpr friend std::strong_ordering operator<=> (recursive_iterator const &lhs, recursive_iterator const &rhs) noexcept
constexpr friend recursive_iterator operator+ (recursive_iterator lhs, difference_type rhs) noexcept
constexpr friend recursive_iterator operator- (recursive_iterator lhs, difference_type rhs) noexcept
constexpr friend recursive_iterator operator+ (difference_type lhs, recursive_iterator rhs) noexcept
constexpr friend difference_type operator- (recursive_iterator const &lhs, recursive_iterator const &rhs) noexcept

Detailed Description

template<typename ParentIt>
class hi::v1::recursive_iterator< ParentIt >

An iterator which recursively iterates through nested containers.

Currently only recurses through two levels of containers.

Constructor & Destructor Documentation

◆ recursive_iterator() [1/3]

template<typename ParentIt>
hi::v1::recursive_iterator< ParentIt >::recursive_iterator ( parent_iterator parent_it,
parent_iterator parent_it_end,
child_iterator child_it )
inlineconstexprnoexcept

Create an iterator at an element inside a child container.

◆ recursive_iterator() [2/3]

template<typename ParentIt>
hi::v1::recursive_iterator< ParentIt >::recursive_iterator ( parent_iterator parent_it,
parent_iterator parent_it_end )
inlineconstexprnoexcept

Create a begin iterator at the first child's first element.

◆ recursive_iterator() [3/3]

template<typename ParentIt>
hi::v1::recursive_iterator< ParentIt >::recursive_iterator ( parent_iterator parent_it_end)
inlineconstexprnoexcept

Create an end iterator one beyond the last child.

Member Function Documentation

◆ at_end()

template<typename ParentIt>
bool hi::v1::recursive_iterator< ParentIt >::at_end ( ) const
inlinenodiscardconstexprnoexcept

Check if the iterator is at end.

This iterator must maintain the parent_end value, to make sure not to dereference the parent iterator at end. This function is used to check if the iterator is at end.

Returns
True if the iterator can no longer advance.

◆ child()

template<typename ParentIt>
child_iterator hi::v1::recursive_iterator< ParentIt >::child ( ) const
inlinenodiscardconstexprnoexcept

Get the current child iterator.

It is undefined behaviour to use this function on an iterator that is at_end().

◆ parent()

template<typename ParentIt>
parent_iterator hi::v1::recursive_iterator< ParentIt >::parent ( ) const
inlinenodiscardconstexprnoexcept

Get the current parent iterator.


The documentation for this class was generated from the following file: