|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Lazy iterator over ordered leaf keys. More...
#include <tpl_bplus_tree.H>
Public Member Functions | |
| Iterator () noexcept=default | |
| Construct an exhausted iterator. | |
| Iterator (const Gen_BPlus_Tree &tree) noexcept | |
| Construct an iterator over the full key order. | |
| Iterator (const Gen_BPlus_Tree &tree, const Key &first, const Key &last) | |
Construct an iterator over the inclusive range [first, last]. | |
| bool | has_curr () const noexcept |
| Return whether the iterator still points to a key. | |
| const Key & | get_curr () const |
| Return the current key. | |
| void | next_ne () |
| Advance to the next key. | |
| void | next () |
| Synonym for next_ne(). | |
| const Key & | operator* () const |
| Dereference the iterator. | |
| const Key * | operator-> () const |
| Member-access shorthand for the current key. | |
Private Member Functions | |
| void | skip_past_end () |
Private Attributes | |
| const Gen_BPlus_Tree * | tree_ = nullptr |
| const Node * | leaf_ = nullptr |
| size_t | idx_ = 0 |
| std::optional< Key > | last_ |
Lazy iterator over ordered leaf keys.
The iterator walks the leaf chain directly and therefore avoids materializing an intermediate Array<Key>. Any mutation of the owning tree invalidates all iterators.
Definition at line 606 of file tpl_bplus_tree.H.
|
defaultnoexcept |
Construct an exhausted iterator.
| Nothing. |
|
inlineexplicitnoexcept |
Construct an iterator over the full key order.
| tree | Tree whose leaf chain will be traversed. |
| Nothing. |
Definition at line 643 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().
|
inline |
Construct an iterator over the inclusive range [first, last].
| tree | Tree whose leaf chain will be traversed. |
| first | Lower bound, inclusive. |
| last | Upper bound, inclusive. |
| std::invalid_argument | If last < first. |
| Any | exception propagated by Compare. |
Definition at line 656 of file tpl_bplus_tree.H.
References ah_invalid_argument_if, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::idx_, Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::leaf_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().
|
inline |
Return the current key.
| std::underflow_error | If the iterator is exhausted. |
Definition at line 681 of file tpl_bplus_tree.H.
References ah_underflow_error_if, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::idx_, Aleph::detail::BPlusTreeNode< Key >::keys, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::leaf_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::operator*(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::operator->().
|
inlinenoexcept |
Return whether the iterator still points to a key.
true if there is a current key, otherwise false. | Nothing. |
Definition at line 672 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::leaf_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::tree_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::get_curr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::next_ne(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::range().
|
inline |
Synonym for next_ne().
| std::underflow_error | If the iterator is exhausted. |
| Any | exception propagated by Compare. |
Definition at line 702 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::next_ne().
|
inline |
Advance to the next key.
| std::underflow_error | If the iterator is exhausted. |
| Any | exception propagated by Compare. |
Definition at line 691 of file tpl_bplus_tree.H.
References ah_underflow_error_if, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::idx_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::next().
|
inline |
Dereference the iterator.
| std::underflow_error | If the iterator is exhausted. |
Definition at line 711 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::get_curr().
|
inline |
Member-access shorthand for the current key.
| std::underflow_error | If the iterator is exhausted. |
Definition at line 720 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::get_curr().
|
inlineprivate |
Definition at line 613 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::idx_, Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::last_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::leaf_, Aleph::detail::BPlusTreeNode< Key >::next, Aleph::Array< T >::size(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::tree_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::next_ne().
|
private |
Definition at line 610 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::get_curr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::next_ne(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().
|
private |
Definition at line 611 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().
|
private |
Definition at line 609 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::get_curr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().
|
private |
Definition at line 608 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end().