|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Iterator on nodes of the tree. More...
#include <tpl_treapRk.H>
Public Member Functions | |
| Iterator () noexcept | |
| Iterator (const Gen_Treap_Rk &__tree) noexcept | |
Initialize an iterator on __tree | |
| Iterator (const Gen_Treap_Rk &__tree, Node *__curr) noexcept | |
Initialize an iterator starting from node __curr | |
| Iterator (const Gen_Treap_Rk &__tree, const size_t pos) noexcept | |
Initialize an iterator starting from the iorder position pos | |
| Iterator (const Iterator &itor) noexcept | |
| Iterator & | operator= (const Iterator &itor) noexcept |
| void | reset_first () noexcept |
| Reset the iterator to the first position. | |
| void | reset_last () noexcept |
| Reset the iterator to the last position. | |
| void | end () noexcept |
| Put the iterator in the end state. | |
| void | reset_to_key (const Key &key) noexcept |
| Put the iterator to a node according to specific key. | |
| void | reset_to_node (Node *node) noexcept |
| Put the current node to a specific node. | |
| void | reset_to_pos (const size_t pos) noexcept |
| Put the current to the position pos. | |
| Node * | get_curr_ne () const noexcept |
| Return the current node. | |
| Node * | get_curr () const noexcept |
| size_t | get_current_position () const |
| return the position of current node | |
| size_t | get_pos () const |
| bool | has_curr () const noexcept |
Return true if iterator has current node. | |
| void | prev () |
| Move the iterator one position backward. | |
| void | next_ne () noexcept |
| void | next () |
| Move the iterator one position forward. | |
| Node * | del () |
| Remove the current node and move the iterator one position forward. | |
| bool | operator== (const Iterator &itor) const noexcept |
Return true if this is equal to itor | |
| bool | operator!= (const Iterator &itor) const |
Return true if this is not equal to itor | |
| bool | verify (Gen_Treap_Rk *r) const noexcept |
| bool | verify (const Iterator &it) const noexcept |
Protected Attributes | |
| Gen_Treap_Rk * | tree_ptr |
| Node * | curr |
| int | curr_pos |
Static Protected Attributes | |
| static constexpr int | Pos_Not_Current = -1 |
| static constexpr int | Pos_Empty_Container = -2 |
| static constexpr int | Pos_Not_Updated = -3 |
Private Member Functions | |
| bool | is_container_empty () const noexcept |
| bool | pos_updated () const noexcept |
| bool | curr_updated () const noexcept |
| bool | is_updated () const noexcept |
| void | update_pos () const noexcept |
| void | update_curr () const noexcept |
Iterator on nodes of the tree.
The visit order is inorder.
Definition at line 755 of file tpl_treapRk.H.
|
inlinenoexcept |
Definition at line 810 of file tpl_treapRk.H.
|
inlinenoexcept |
Initialize an iterator on __tree
Definition at line 817 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_container_empty(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Empty_Container.
|
inlinenoexcept |
Initialize an iterator starting from node __curr
Definition at line 824 of file tpl_treapRk.H.
|
inlinenoexcept |
Initialize an iterator starting from the iorder position pos
Definition at line 832 of file tpl_treapRk.H.
|
inlinenoexcept |
Definition at line 839 of file tpl_treapRk.H.
|
inlineprivatenoexcept |
Definition at line 779 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::del(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr_ne(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_updated(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==().
|
inline |
Remove the current node and move the iterator one position forward.
Definition at line 981 of file tpl_treapRk.H.
References ah_underflow_error_if, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), KEY, Aleph::maps(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::remove(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr().
|
inlinenoexcept |
Put the iterator in the end state.
Definition at line 873 of file tpl_treapRk.H.
References put_itor_at_the_end().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 919 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr_ne().
|
inlinenoexcept |
Return the current node.
Definition at line 910 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_updated(), Aleph::maps(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr().
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr().
|
inline |
return the position of current node
| underflow_error | if the iterator has not current node after a prev() operation |
| overflow_error | if the iterator has not current node after a next() operation |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 932 of file tpl_treapRk.H.
References ah_range_error_if, Aleph::COUNT(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::maps(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos().
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_pos().
|
inline |
Definition at line 945 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position().
|
inlinenoexcept |
Return true if iterator has current node.
Definition at line 948 of file tpl_treapRk.H.
References Aleph::COUNT(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::maps(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos().
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::del(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::prev().
|
inlineprivatenoexcept |
Definition at line 769 of file tpl_treapRk.H.
References Aleph::COUNT(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_first(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_last().
|
inlineprivatenoexcept |
Definition at line 784 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_updated(), Aleph::maps(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated().
|
inline |
Move the iterator one position forward.
Throws overflow_error if there is no current
Definition at line 974 of file tpl_treapRk.H.
References ah_underflow_error_if, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::maps(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next_ne().
|
inlinenoexcept |
Definition at line 966 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next().
|
inline |
Return true if this is not equal to itor
Definition at line 1019 of file tpl_treapRk.H.
References Aleph::maps().
|
inlinenoexcept |
|
inlinenoexcept |
Return true if this is equal to itor
Definition at line 996 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_container_empty(), Aleph::maps(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos().
|
inlineprivatenoexcept |
Definition at line 774 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Not_Updated.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_updated(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==().
|
inline |
Move the iterator one position backward.
Throws underflow_error if there is no current
Definition at line 958 of file tpl_treapRk.H.
References ah_underflow_error_if, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), and Aleph::maps().
|
inlinenoexcept |
Reset the iterator to the first position.
Definition at line 858 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_container_empty(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Empty_Container.
|
inlinenoexcept |
Reset the iterator to the last position.
Definition at line 865 of file tpl_treapRk.H.
References Aleph::COUNT(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_container_empty(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Empty_Container, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
|
inlinenoexcept |
Put the iterator to a node according to specific key.
If key is not present, then the iterator is put on the node
| [in] | key | to guide the position |
| domain_error | if the key is not contained in the tree. |
Definition at line 885 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::find_position(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
|
inlinenoexcept |
Put the current node to a specific node.
| [in] | node | to put as current |
Definition at line 896 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos.
|
inlinenoexcept |
Put the current to the position pos.
Definition at line 903 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos.
|
inlineprivatenoexcept |
Definition at line 797 of file tpl_treapRk.H.
References Aleph::COUNT(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::maps(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Empty_Container, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Not_Current, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Pos_Not_Updated, Aleph::select(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::del(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr_ne().
|
inlineprivatenoexcept |
Definition at line 789 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::cmp, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_pos, Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::inorder_position(), KEY, Aleph::maps(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==().
|
inlinenoexcept |
Definition at line 1029 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
|
inlinenoexcept |
Definition at line 1024 of file tpl_treapRk.H.
References Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::getRoot(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::r, and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::tree_ptr.
|
mutableprotected |
Definition at line 760 of file tpl_treapRk.H.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::curr_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::del(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr_ne(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next_ne(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator=(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::prev(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_first(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_last(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_node(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_pos(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos().
|
mutableprotected |
Definition at line 761 of file tpl_treapRk.H.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next_ne(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator=(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::prev(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_first(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_last(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_key(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_node(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_pos(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos().
|
staticconstexprprotected |
Definition at line 764 of file tpl_treapRk.H.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::Iterator(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_first(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_last(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr().
|
staticconstexprprotected |
Definition at line 763 of file tpl_treapRk.H.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr().
|
staticconstexprprotected |
Definition at line 765 of file tpl_treapRk.H.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::pos_updated(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr().
|
mutableprotected |
Definition at line 759 of file tpl_treapRk.H.
Referenced by Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::del(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_container_empty(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator=(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_last(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_key(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_curr(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::update_pos(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::verify(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::verify().