Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::DynIntervalTree< T, Compare >::Iterator Class Reference

Inorder iterator yielding Interval<T> keys. More...

#include <tpl_interval_tree.H>

Public Member Functions

 Iterator () noexcept=default
 Default constructor.
 
 Iterator (const DynIntervalTree &t)
 Construct for a given tree.
 
bool has_curr () const noexcept
 Check if there is a current element.
 
const Key & get_curr () const
 Return the current interval.
 
const Key & get_curr_ne () const noexcept
 Return the current interval (no check).
 
void next ()
 Advance to the next element.
 
void next_ne () noexcept(noexcept(it.next_ne()))
 Advance to the next element (no check).
 
void reset_first () noexcept(noexcept(it.reset_first()))
 Reset to the first element in traversal order.
 
void end () noexcept
 Move to the position after the last element.
 
size_t get_pos () const
 Return the 0-indexed current position.
 

Private Attributes

Tree::Iterator it
 

Detailed Description

template<typename T, class Compare = Aleph::less<T>>
class Aleph::DynIntervalTree< T, Compare >::Iterator

Inorder iterator yielding Interval<T> keys.

Satisfies the Aleph iterator protocol (has_curr/get_curr/next).

Definition at line 1768 of file tpl_interval_tree.H.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename T , class Compare = Aleph::less<T>>
Aleph::DynIntervalTree< T, Compare >::Iterator::Iterator ( )
defaultnoexcept

Default constructor.

◆ Iterator() [2/2]

template<typename T , class Compare = Aleph::less<T>>
Aleph::DynIntervalTree< T, Compare >::Iterator::Iterator ( const DynIntervalTree &  t)
inline

Construct for a given tree.

Parameters
[in]ttree to iterate over.

Definition at line 1779 of file tpl_interval_tree.H.

Member Function Documentation

◆ end()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::end ( )
inlinenoexcept

Move to the position after the last element.

Exceptions
none

Definition at line 1824 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::end(), and Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ get_curr()

template<typename T , class Compare = Aleph::less<T>>
const Key & Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr ( ) const
inline

Return the current interval.

Returns
constant reference to interval.
Exceptions
ah_invalid_argumentif no current element exists.

Definition at line 1790 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::get_curr(), Aleph::DynIntervalTree< T, Compare >::Iterator::it, and KEY.

◆ get_curr_ne()

template<typename T , class Compare = Aleph::less<T>>
const Key & Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr_ne ( ) const
inlinenoexcept

Return the current interval (no check).

Returns
constant reference to interval.
Exceptions
none

Definition at line 1799 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::get_curr_ne(), Aleph::DynIntervalTree< T, Compare >::Iterator::it, and KEY.

◆ get_pos()

template<typename T , class Compare = Aleph::less<T>>
size_t Aleph::DynIntervalTree< T, Compare >::Iterator::get_pos ( ) const
inline

Return the 0-indexed current position.

Returns
index of current element.
Exceptions
ah_invalid_argumentif no current element.

Definition at line 1830 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::get_pos(), and Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ has_curr()

template<typename T , class Compare = Aleph::less<T>>
bool Aleph::DynIntervalTree< T, Compare >::Iterator::has_curr ( ) const
inlinenoexcept

Check if there is a current element.

Returns
true if valid current element exists.

Definition at line 1784 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::has_curr(), and Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ next()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::next ( )
inline

Advance to the next element.

Exceptions
ah_invalid_argumentif already at end.

Definition at line 1807 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it, and Aleph::BinNodeInfixIterator< Node >::next().

◆ next_ne()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::next_ne ( )
inlinenoexcept

Advance to the next element (no check).

Exceptions
bad_alloconly if the tree is deeper than the inline capacity of the iterator (its node's MaxHeight, at most 128) and the pending nodes cannot be moved to the heap.

Definition at line 1814 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it, and Aleph::BinNodeInfixIterator< Node >::next_ne().

◆ reset_first()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::reset_first ( )
inlinenoexcept

Reset to the first element in traversal order.

Exceptions
bad_allocas next_ne() does.

Definition at line 1819 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it, and Aleph::BinNodeInfixIterator< Node >::reset_first().

Member Data Documentation

◆ it


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