|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Preorder iterator on the nodes of a binary tree. More...
#include <tpl_binNodeUtils.H>
Public Member Functions | |
| void | swap (BinNodePrefixIterator &it) noexcept |
Swap thiswith it | |
| BinNodePrefixIterator ()=default | |
| BinNodePrefixIterator (Node *r) noexcept | |
Initialize an iterator on the first node in preorder for the tree with root r | |
| BinNodePrefixIterator (const BinNodePrefixIterator &it) | |
| BinNodePrefixIterator (BinNodePrefixIterator &&it) noexcept | |
| void | reset_first () noexcept |
| Reset the iterator to the first node in preorder sense. | |
| void | reset_last () noexcept |
| Reset the iterator to the last node in preorder. | |
| void | end () noexcept |
| Put the iterator in end state. | |
| BinNodePrefixIterator & | operator= (const BinNodePrefixIterator &it) |
| BinNodePrefixIterator & | operator= (BinNodePrefixIterator &&it) noexcept |
| bool | has_curr () const noexcept |
Return true if iterator has current node. | |
| Node * | get_curr_ne () const noexcept |
| Return the current link guaranteeing no exception. Be careful. | |
| Node * | get_curr () const |
| Return a pointer to current node. | |
| void | next_ne () |
| Move the iterator one position forward without checking it. | |
| void | next () |
| Move the iterator one position forward. | |
Static Private Member Functions | |
| static Node * | last (Node *p) noexcept |
Private Attributes | |
| Node * | root = nullptr |
| Node * | curr = Node::NullPtr |
| SmallVector< Node *, Inline_Depth > | s |
Static Private Attributes | |
| static constexpr size_t | Inline_Depth = Node::MaxHeight < 128 ? Node::MaxHeight : 128 |
Preorder 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 preorder sense.
Definition at line 2758 of file tpl_binNodeUtils.H.
|
default |
|
inlinenoexcept |
Initialize an iterator on the first node in preorder for the tree with root r
Definition at line 2784 of file tpl_binNodeUtils.H.
|
inline |
Definition at line 2789 of file tpl_binNodeUtils.H.
|
inlinenoexcept |
Definition at line 2794 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::swap().
|
inlinenoexcept |
Put the iterator in end state.
Definition at line 2834 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::SmallVector< T, N >::empty(), and Aleph::BinNodePrefixIterator< Node >::s.
|
inline |
Return a pointer to current node.
Definition at line 2870 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodePrefixIterator< Node >::get_curr_ne(), and Aleph::BinNodePrefixIterator< Node >::has_curr().
|
inlinenoexcept |
Return the current link guaranteeing no exception. Be careful.
Definition at line 2864 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr.
Referenced by Aleph::BinNodePrefixIterator< Node >::get_curr().
|
inlinenoexcept |
Return true if iterator has current node.
Definition at line 2858 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr.
Referenced by Aleph::BinNodePrefixIterator< Node >::get_curr(), Aleph::lazy_pre_order(), Aleph::BinNodePrefixIterator< Node >::next(), Aleph::prefix_for_each(), and Aleph::prefix_traverse().
|
inlinestaticprivatenoexcept |
Definition at line 2808 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::last(), LLINK, and RLINK.
Referenced by Aleph::BinNodePrefixIterator< Node >::last(), and Aleph::BinNodePrefixIterator< Node >::reset_last().
|
inline |
Move the iterator one position forward.
Definition at line 2905 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodePrefixIterator< Node >::has_curr(), and Aleph::BinNodePrefixIterator< Node >::next_ne().
|
inline |
Move the iterator one position forward without checking it.
Be careful.
| 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 2881 of file tpl_binNodeUtils.H.
References Aleph::SmallVector< T, N >::append(), Aleph::BinNodePrefixIterator< Node >::curr, Aleph::SmallVector< T, N >::is_empty(), l, LLINK, r, Aleph::SmallVector< T, N >::remove_last(), RLINK, and Aleph::BinNodePrefixIterator< Node >::s.
Referenced by Aleph::BinNodePrefixIterator< Node >::next().
|
inlinenoexcept |
Definition at line 2851 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::swap().
|
inline |
Definition at line 2840 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::BinNodePrefixIterator< Node >::root, and Aleph::BinNodePrefixIterator< Node >::s.
|
inlinenoexcept |
Reset the iterator to the first node in preorder sense.
Definition at line 2800 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::SmallVector< T, N >::empty(), Aleph::BinNodePrefixIterator< Node >::root, and Aleph::BinNodePrefixIterator< Node >::s.
|
inlinenoexcept |
Reset the iterator to the last node in preorder.
Definition at line 2821 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::SmallVector< T, N >::empty(), Aleph::BinNodePrefixIterator< Node >::last(), Aleph::BinNodePrefixIterator< Node >::root, and Aleph::BinNodePrefixIterator< Node >::s.
|
inlinenoexcept |
Swap thiswith it
Definition at line 2773 of file tpl_binNodeUtils.H.
References Aleph::BinNodePrefixIterator< Node >::curr, Aleph::BinNodePrefixIterator< Node >::root, Aleph::BinNodePrefixIterator< Node >::s, and Aleph::SmallVector< T, N >::swap().
Referenced by Aleph::BinNodePrefixIterator< Node >::BinNodePrefixIterator(), and Aleph::BinNodePrefixIterator< Node >::operator=().
|
private |
Definition at line 2761 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodePrefixIterator< Node >::end(), Aleph::BinNodePrefixIterator< Node >::get_curr_ne(), Aleph::BinNodePrefixIterator< Node >::has_curr(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::BinNodePrefixIterator< Node >::operator=(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), and Aleph::BinNodePrefixIterator< Node >::swap().
|
staticconstexprprivate |
Definition at line 2768 of file tpl_binNodeUtils.H.
|
private |
Definition at line 2760 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodePrefixIterator< Node >::operator=(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), and Aleph::BinNodePrefixIterator< Node >::swap().
|
private |
Definition at line 2769 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodePrefixIterator< Node >::end(), Aleph::BinNodePrefixIterator< Node >::next_ne(), Aleph::BinNodePrefixIterator< Node >::operator=(), Aleph::BinNodePrefixIterator< Node >::reset_first(), Aleph::BinNodePrefixIterator< Node >::reset_last(), and Aleph::BinNodePrefixIterator< Node >::swap().