|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Inorder iterator on the nodes of a binary tree. More...
#include <tpl_binNodeUtils.H>
Public Member Functions | |
| bool | is_in_first () const noexcept |
Return true if the iterator is on the first node. | |
| bool | is_last () const noexcept |
| void | swap (BinNodeInfixIterator &it) noexcept |
| BinNodeInfixIterator ()=default | |
| BinNodeInfixIterator (Node *r) | |
| Initialize an iterator on the first node inorder. | |
| BinNodeInfixIterator (const BinNodeInfixIterator &it) | |
| BinNodeInfixIterator (BinNodeInfixIterator &&it) noexcept | |
| void | reset_first () |
| Reset the iterator to the first node inorder; it may throw bad_alloc, as the constructor does. | |
| void | reset_last () noexcept |
| Reset the iterator to the last node inorder. | |
| void | end () noexcept |
| BinNodeInfixIterator & | operator= (const BinNodeInfixIterator &it) |
| BinNodeInfixIterator & | operator= (BinNodeInfixIterator &&it) noexcept |
| bool | has_curr () const noexcept |
Return true the iterator has current node. | |
| Node * | get_curr_ne () const noexcept |
| Return the current link guaranteeing no exception. Be careful. | |
| Node * | get_curr () const |
Return the current node. Throw overflow_error if there is no current. | |
| size_t | get_pos () const |
| Return the current position of iterator. Only valid if has_curr() == true. | |
| void | next_ne () |
| Move forward without checking the position; it may throw bad_alloc, as the constructor does. | |
| void | next () |
| Move the iterator one position forward. | |
Private Member Functions | |
| Node * | advance_to_min (Node *r) |
| void | init () |
Static Private Member Functions | |
| static Node * | advance_to_max (Node *r) noexcept |
Private Attributes | |
| Node * | root = Node::NullPtr |
| Node * | curr = Node::NullPtr |
| long | pos = 0 |
| SmallVector< Node *, Inline_Depth > | s |
Static Private Attributes | |
| static constexpr size_t | Inline_Depth = Node::MaxHeight < 128 ? Node::MaxHeight : 128 |
Inorder iterator on the nodes of a binary tree.
This class export a full iterator for the nodes of a binary tree where the visit order corresponds to a inorder sense.
Definition at line 2977 of file tpl_binNodeUtils.H.
|
default |
|
inline |
Initialize an iterator on the first node inorder.
| bad_alloc | if the tree is deeper than the inline capacity of the iterator (Node::MaxHeight, at most 128) and the pending nodes cannot be moved to the heap. |
Definition at line 3044 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::init().
|
inline |
Definition at line 3049 of file tpl_binNodeUtils.H.
|
inlinenoexcept |
Definition at line 3055 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::swap().
|
inlinestaticprivatenoexcept |
Definition at line 3002 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::reset_last().
|
inlineprivate |
Definition at line 2992 of file tpl_binNodeUtils.H.
References Aleph::SmallVector< T, N >::append(), LLINK, r, and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::BinNodeInfixIterator< Node >::init(), and Aleph::BinNodeInfixIterator< Node >::next_ne().
|
inlinenoexcept |
Definition at line 3083 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr, Aleph::SmallVector< T, N >::empty(), Aleph::BinNodeInfixIterator< Node >::pos, and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::end().
|
inline |
Return the current node. Throw overflow_error if there is no current.
Definition at line 3121 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodeInfixIterator< Node >::curr, and Aleph::BinNodeInfixIterator< Node >::has_curr().
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr().
|
inlinenoexcept |
Return the current link guaranteeing no exception. Be careful.
Definition at line 3115 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr_ne(), and TEST().
|
inline |
Return the current position of iterator. Only valid if has_curr() == true.
Definition at line 3128 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, and Aleph::size().
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::get_pos().
|
inlinenoexcept |
Return true the iterator has current node.
Definition at line 3109 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr.
Referenced by Aleph::BinNodeInfixIterator< Node >::get_curr(), Aleph::DynIntervalTree< T, Compare >::Iterator::has_curr(), Aleph::infix_for_each(), Aleph::infix_traverse(), Aleph::lazy_in_order(), Aleph::BinNodeInfixIterator< Node >::next(), TEST(), and TEST().
|
inlineprivate |
Definition at line 3010 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::pos, and Aleph::BinNodeInfixIterator< Node >::root.
Referenced by Aleph::BinNodeInfixIterator< Node >::BinNodeInfixIterator(), and Aleph::BinNodeInfixIterator< Node >::reset_first().
|
inlinenoexcept |
Return true if the iterator is on the first node.
Definition at line 3019 of file tpl_binNodeUtils.H.
References Aleph::and, Aleph::BinNodeInfixIterator< Node >::curr, Aleph::SmallVector< T, N >::is_empty(), LLINK, and Aleph::BinNodeInfixIterator< Node >::s.
|
inlinenoexcept |
Definition at line 3024 of file tpl_binNodeUtils.H.
References Aleph::and, Aleph::BinNodeInfixIterator< Node >::curr, Aleph::SmallVector< T, N >::is_empty(), RLINK, and Aleph::BinNodeInfixIterator< Node >::s.
|
inline |
Move the iterator one position forward.
Throw overflow_error if there is no current
Definition at line 3158 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodeInfixIterator< Node >::has_curr(), and Aleph::BinNodeInfixIterator< Node >::next_ne().
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::next().
|
inline |
Move forward without checking the position; it may throw bad_alloc, as the constructor does.
Definition at line 3137 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodeInfixIterator< Node >::curr, Aleph::SmallVector< T, N >::is_empty(), Aleph::BinNodeInfixIterator< Node >::pos, Aleph::SmallVector< T, N >::remove_last(), RLINK, Aleph::BinNodeInfixIterator< Node >::root, Aleph::BinNodeInfixIterator< Node >::s, and Aleph::size().
Referenced by Aleph::BinNodeInfixIterator< Node >::next(), Aleph::DynIntervalTree< T, Compare >::Iterator::next_ne(), and TEST().
|
inlinenoexcept |
Definition at line 3102 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::swap().
|
inline |
Definition at line 3090 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, and Aleph::BinNodeInfixIterator< Node >::s.
|
inline |
Reset the iterator to the first node inorder; it may throw bad_alloc, as the constructor does.
Definition at line 3062 of file tpl_binNodeUtils.H.
References Aleph::SmallVector< T, N >::empty(), Aleph::BinNodeInfixIterator< Node >::init(), and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::reset_first().
|
inlinenoexcept |
Reset the iterator to the last node inorder.
Definition at line 3069 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::advance_to_max(), Aleph::BinNodeInfixIterator< Node >::curr, Aleph::SmallVector< T, N >::empty(), Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, and Aleph::BinNodeInfixIterator< Node >::s.
|
inlinenoexcept |
Definition at line 3029 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, Aleph::BinNodeInfixIterator< Node >::s, and Aleph::SmallVector< T, N >::swap().
Referenced by Aleph::BinNodeInfixIterator< Node >::BinNodeInfixIterator(), and Aleph::BinNodeInfixIterator< Node >::operator=().
|
private |
Definition at line 2980 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::get_curr(), Aleph::BinNodeInfixIterator< Node >::get_curr_ne(), Aleph::BinNodeInfixIterator< Node >::has_curr(), Aleph::BinNodeInfixIterator< Node >::init(), Aleph::BinNodeInfixIterator< Node >::is_in_first(), Aleph::BinNodeInfixIterator< Node >::is_last(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().
|
staticconstexprprivate |
Definition at line 2989 of file tpl_binNodeUtils.H.
|
mutableprivate |
Definition at line 2981 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::get_pos(), Aleph::BinNodeInfixIterator< Node >::init(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().
|
mutableprivate |
Definition at line 2979 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::get_pos(), Aleph::BinNodeInfixIterator< Node >::init(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().
|
private |
Definition at line 2990 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::is_in_first(), Aleph::BinNodeInfixIterator< Node >::is_last(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_first(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().