|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Generic B+ Tree with configurable minimum degree. More...
#include <tpl_bplus_tree.H>
Classes | |
| class | Iterator |
| Lazy iterator over ordered leaf keys. More... | |
Public Types | |
| using | key_type = Key |
| Stored key type. | |
Public Member Functions | |
| Gen_BPlus_Tree (const Compare &cmp=Compare()) | |
| Construct an empty B+ Tree. | |
| template<std::input_iterator It> | |
| Gen_BPlus_Tree (It first, It last, const Compare &cmp=Compare()) | |
| Construct a B+ Tree from an iterator range. | |
| Gen_BPlus_Tree (std::initializer_list< Key > init, const Compare &cmp=Compare()) | |
| Construct a B+ Tree from an initializer list. | |
| Gen_BPlus_Tree (const Gen_BPlus_Tree &other) | |
| Copy constructor performing a deep copy. | |
| Gen_BPlus_Tree (Gen_BPlus_Tree &&other)=default | |
| Move constructor. | |
| Gen_BPlus_Tree & | operator= (const Gen_BPlus_Tree &other) |
| Copy assignment. | |
| Gen_BPlus_Tree & | operator= (Gen_BPlus_Tree &&other)=default |
| Move assignment. | |
| const Compare & | key_comp () const noexcept |
| Return the comparison object (read-only). | |
| const Compare & | get_compare () const noexcept |
| Return the comparison object (read-only). | |
| bool | empty () const noexcept |
| Return whether the tree has no keys. | |
| bool | is_empty () const noexcept |
| Synonym for empty() in traditional Aleph style. | |
| size_t | size () const noexcept |
| Return the number of stored keys. | |
| size_t | height () const noexcept |
| Return the current tree height. | |
| void | clear () noexcept |
| Remove every key from the tree. | |
| bool | contains (const Key &key) const |
| Return whether a key is present. | |
| bool | search (const Key &key) const |
| Synonym for contains(). | |
| bool | insert (const Key &key) |
| Insert a key if it is not already present. | |
| bool | insert (Key &&key) |
| Insert a key by move if it is not already present. | |
| bool | remove (const Key &key) |
| Remove a key if present. | |
| std::optional< Key > | min_key () const |
| Return the minimum key, if any. | |
| std::optional< Key > | max_key () const |
| Return the maximum key, if any. | |
| std::optional< Key > | lower_bound (const Key &key) const |
Return the first key not less than key. | |
| std::optional< Key > | upper_bound (const Key &key) const |
Return the first key strictly greater than key. | |
| Iterator | get_it () const noexcept |
| Return a lazy iterator over the full key order. | |
| Iterator | get_range_it (const Key &first, const Key &last) const |
| Return a lazy iterator over an inclusive key range. | |
| Array< Key > | range (const Key &first, const Key &last) const |
Collect all keys in the inclusive range [first, last]. | |
| Array< Key > | keys () const |
| Materialize the tree contents in sorted order. | |
| bool | verify () const |
| Verify structural B+ Tree invariants. | |
Private Types | |
| using | Node = detail::BPlusTreeNode< Key > |
Static Private Member Functions | |
| template<typename T , typename U > | |
| static void | insert_at (Array< T > &array, const size_t idx, U &&value) |
| template<typename T > | |
| static T | erase_at (Array< T > &array, const size_t idx) |
| template<typename T > | |
| static void | truncate (Array< T > &array, const size_t new_size) |
| template<typename T > | |
| static void | append_copy_range (Array< T > &dst, const Array< T > &src, const size_t from) |
| template<typename T > | |
| static void | append_move_range (Array< T > &dst, Array< T > &src, const size_t from) |
Private Attributes | |
| std::unique_ptr< Node > | root_ |
| size_t | size_ = 0 |
| Compare | cmp_ |
Static Private Attributes | |
| static constexpr size_t | MaxKeys = 2 * MinDegree - 1 |
| static constexpr size_t | MinKeys = MinDegree - 1 |
Generic B+ Tree with configurable minimum degree.
Gen_BPlus_Tree models an ordered set of unique keys. All payload keys are stored in leaves, while internal nodes keep only separator keys. This organization is specially convenient for page-oriented indexes, database style range scans, and any workload where ordered iteration matters as much as point lookups.
| Key | Key type stored in the tree. |
| Compare | Strict weak ordering used to sort keys. |
| MinDegree | Minimum degree t of the B+ Tree. Valid values are t >= 2. |
k is the number of reported keysfalse. Array<Key> results. Mutating operations preserve leaf links and search invariants if Compare and Key operations do not throw in the middle of internal node updates; allocation failures propagate as std::bad_alloc. Definition at line 134 of file tpl_bplus_tree.H.
| using Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::key_type = Key |
Stored key type.
Definition at line 598 of file tpl_bplus_tree.H.
|
private |
Definition at line 139 of file tpl_bplus_tree.H.
|
inlineexplicit |
Construct an empty B+ Tree.
| cmp | Comparison functor used to sort keys. |
| Nothing. |
Definition at line 730 of file tpl_bplus_tree.H.
|
inline |
Construct a B+ Tree from an iterator range.
| first | First element to insert. |
| last | One-past-the-end iterator. |
| cmp | Comparison functor used to sort keys. |
| std::bad_alloc | if internal storage allocation fails. |
Definition at line 738 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_range().
|
inline |
Construct a B+ Tree from an initializer list.
| init | Keys to insert. |
| cmp | Comparison functor used to sort keys. |
| std::bad_alloc | if internal storage allocation fails. |
Definition at line 748 of file tpl_bplus_tree.H.
|
inline |
Copy constructor performing a deep copy.
| other | Tree to copy. |
| std::bad_alloc | if cloning internal nodes fails. |
Definition at line 756 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clone_node(), Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_.
|
default |
Move constructor.
| other | Tree to move from. |
|
inlinestaticprivate |
Definition at line 220 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::merge_children(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
|
inlinestaticprivate |
Definition at line 227 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::merge_children(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
|
inlineprivate |
Definition at line 407 of file tpl_bplus_tree.H.
References Aleph::Array< T >::append(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::erase_at(), Aleph::Array< T >::get_first(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow().
|
inlineprivate |
Definition at line 386 of file tpl_bplus_tree.H.
References Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_last(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators(), and Aleph::Array< T >::remove_last().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow().
|
inlineprivate |
Definition at line 164 of file tpl_bplus_tree.H.
References Aleph::detail::BPlusTreeNode< Key >::keys, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound_index().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from().
|
inlinenoexcept |
Remove every key from the tree.
| Nothing. |
Definition at line 850 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
|
inlineprivate |
Definition at line 297 of file tpl_bplus_tree.H.
References Aleph::detail::BPlusTreeNode< Key >::children, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clone_node(), Aleph::copy(), Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators(), and Aleph::Array< T >::reserve().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Gen_BPlus_Tree(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clone_node().
|
inline |
Return whether a key is present.
| key | Key to search. |
true if the key exists, otherwise false. | Any | exception propagated by Compare. |
Definition at line 861 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains_in(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::search().
|
inlineprivate |
Definition at line 328 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::equals(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains().
|
inlinenoexcept |
Return whether the tree has no keys.
true if empty, otherwise false. | Nothing. |
Definition at line 815 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::is_empty().
|
inlineprivate |
Definition at line 169 of file tpl_bplus_tree.H.
References Aleph::detail::bplus_equiv(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, and Aleph::divide_and_conquer_partition_dp().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains_in(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound_index(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlinestaticprivate |
Definition at line 202 of file tpl_bplus_tree.H.
References Aleph::close_gap(), Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::remove_last(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::borrow_from_next(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::merge_children(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from().
|
inlineprivate |
Definition at line 320 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::child_index(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BPlusTreeNode< Key >::leaf, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains_in(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound().
|
inlineprivate |
Definition at line 448 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::borrow_from_next(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::borrow_from_prev(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::merge_children(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::MinKeys, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from().
|
inlinenoexcept |
Return the comparison object (read-only).
| Nothing. |
Definition at line 806 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::key_comp().
|
inlinenoexcept |
Return a lazy iterator over the full key order.
| Nothing. |
Definition at line 1020 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys().
|
inline |
Return a lazy iterator over an inclusive key range.
| first | Lower endpoint, inclusive. |
| last | Upper endpoint, inclusive. |
| std::invalid_argument | if last < first according to Compare. |
| Any | exception propagated by Compare. |
Definition at line 1032 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::range().
|
inlinenoexcept |
Return the current tree height.
0 for an empty tree, otherwise the number of node levels. | Nothing. |
Definition at line 842 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::height_of(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::height_of().
|
inlineprivatenoexcept |
Definition at line 273 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::height().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::height().
|
inline |
Insert a key if it is not already present.
| key | Key to insert. |
true if insertion happened, false if it was duplicate. | std::bad_alloc | if node growth fails. |
| Any | exception propagated by Compare or Key copy/move operations. |
Definition at line 883 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::MaxKeys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_range().
|
inline |
Insert a key by move if it is not already present.
| key | Key to insert. |
true if insertion happened, false if it was duplicate. | std::bad_alloc | if node growth fails. |
| Any | exception propagated by Compare or Key move/copy operations. |
Definition at line 916 of file tpl_bplus_tree.H.
References Aleph::copy(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert().
|
inlinestaticprivate |
Definition at line 188 of file tpl_bplus_tree.H.
References Aleph::Array< T >::append(), Aleph::open_gap(), Aleph::Array< T >::putn(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::borrow_from_prev(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
|
inlineprivate |
Definition at line 366 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::child_index(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::MaxKeys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull().
|
inlineprivate |
Definition at line 182 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Gen_BPlus_Tree().
|
inlinenoexcept |
Synonym for empty() in traditional Aleph style.
true if empty, otherwise false. | Nothing. |
Definition at line 824 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::empty().
|
inlinenoexcept |
Return the comparison object (read-only).
| Nothing. |
Definition at line 796 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::get_compare().
|
inline |
Materialize the tree contents in sorted order.
| std::bad_alloc | if the result array cannot grow. |
| Any | exception propagated by Key copy construction. |
Definition at line 1060 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::get_it(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), Aleph::Array< T >::reserve(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::strictly_sorted(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound_index(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivatenoexcept |
Definition at line 234 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), and Aleph::detail::BPlusTreeNode< Key >::leaf.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_min_ptr(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_leaf_chain().
|
inline |
Return the first key not less than key.
| key | Probe key. |
std::nullopt if none exists. | Any | exception propagated by Compare or Key copy construction. |
Definition at line 975 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::detail::BPlusTreeNode< Key >::next, and Aleph::Array< T >::size().
|
inlineprivate |
Definition at line 148 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains_in(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from().
|
inline |
Return the maximum key, if any.
std::nullopt if empty. | Any | exception propagated by Key copy construction. |
Definition at line 962 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_max_ptr().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivate |
Definition at line 428 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::append_copy_range(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::append_move_range(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::erase_at(), GenericItems< Container, T >::keys(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::detail::BPlusTreeNode< Key >::next, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow().
|
inline |
Return the minimum key, if any.
std::nullopt if empty. | Any | exception propagated by Key copy construction. |
Definition at line 950 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_min_ptr().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inline |
Copy assignment.
| other | Tree to copy from. |
*this. Definition at line 771 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
|
default |
Move assignment.
| other | Tree to move from. |
*this.
|
inline |
Collect all keys in the inclusive range [first, last].
| first | Lower endpoint, inclusive. |
| last | Upper endpoint, inclusive. |
| std::invalid_argument | if last < first according to Compare. |
| std::bad_alloc | if the result array cannot grow. |
| Any | exception propagated by Compare or Key copy construction. |
Definition at line 1045 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::get_range_it(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), and Aleph::Array< T >::reserve().
|
inlineprivate |
Definition at line 286 of file tpl_bplus_tree.H.
References Aleph::Array< T >::append(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::empty(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Array< T >::reserve(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_min().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::borrow_from_next(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::borrow_from_prev(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clone_node(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::merge_children(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
|
inline |
Remove a key if present.
| key | Key to erase. |
true if the key was removed, otherwise false. | Any | exception propagated by Compare or Key assignments. |
Definition at line 927 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
|
inlineprivate |
Definition at line 474 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::child_index(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::equals(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::erase_at(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove_from().
|
inlineprivatenoexcept |
Definition at line 242 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), and Aleph::detail::BPlusTreeNode< Key >::leaf.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_max_ptr().
|
inline |
Synonym for contains().
| key | Key to search. |
true if the key exists, otherwise false. | Any | exception propagated by Compare. |
Definition at line 871 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains().
|
inlinenoexcept |
Return the number of stored keys.
| Nothing. |
Definition at line 833 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
|
inlineprivate |
Definition at line 341 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::append_copy_range(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::append_move_range(), Aleph::detail::BPlusTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::MinKeys, Aleph::detail::BPlusTreeNode< Key >::next, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::truncate().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull().
|
inlineprivate |
Definition at line 174 of file tpl_bplus_tree.H.
References Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivatenoexcept |
Definition at line 258 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_last(), Aleph::Array< T >::is_empty(), Aleph::detail::BPlusTreeNode< Key >::keys, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rightmost_leaf().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::max_key(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivate |
Definition at line 266 of file tpl_bplus_tree.H.
References ah_runtime_error_unless, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_min_ptr().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rebuild_separators().
|
inlineprivatenoexcept |
Definition at line 250 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_first(), Aleph::Array< T >::is_empty(), Aleph::detail::BPlusTreeNode< Key >::keys, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::leftmost_leaf().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::min_key(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_min(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlinestaticprivate |
Definition at line 214 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::remove_last(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child().
|
inline |
Return the first key strictly greater than key.
| key | Probe key. |
std::nullopt if none exists. | Any | exception propagated by Compare or Key copy construction. |
Definition at line 998 of file tpl_bplus_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BPlusTreeNode< Key >::next, Aleph::Array< T >::size(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound_index().
|
inlineprivate |
Definition at line 156 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::equals(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::child_index(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound().
|
inline |
Verify structural B+ Tree invariants.
true if the tree is structurally valid, otherwise false. | Any | exception propagated by Compare. |
Definition at line 1074 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_leaf_chain(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivate |
Definition at line 495 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_first(), Aleph::Array< T >::get_last(), Aleph::Array< T >::is_empty(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::leftmost_leaf(), Aleph::detail::BPlusTreeNode< Key >::next, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size_.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify().
|
inlineprivate |
Definition at line 528 of file tpl_bplus_tree.H.
References Aleph::and, Aleph::detail::BPlusTreeNode< Key >::children, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::equals(), Aleph::Array< T >::get_first(), Aleph::Array< T >::get_last(), Aleph::Array< T >::is_empty(), Aleph::detail::BPlusTreeNode< Key >::keys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BPlusTreeNode< Key >::leaf, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::max_key(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::MaxKeys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::min_key(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::MinKeys, Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::root_, Aleph::Array< T >::size(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::strictly_sorted(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_max_ptr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::subtree_min_ptr(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
private |
Definition at line 146 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::Iterator(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::equals(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::key_comp(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::operator=(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::strictly_sorted(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound_index(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_leaf_chain(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
staticconstexprprivate |
Definition at line 141 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
staticconstexprprivate |
Definition at line 142 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::split_child(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
private |
Definition at line 144 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Gen_BPlus_Tree(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clear(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::height(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::max_key(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::min_key(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::operator=(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_leaf_chain(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node().
|
private |
Definition at line 145 of file tpl_bplus_tree.H.
Referenced by Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clear(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::empty(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::keys(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::operator=(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::size(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify(), and Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_leaf_chain().