|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Generic B-Tree with configurable minimum degree. More...
#include <tpl_b_tree.H>
Public Types | |
| using | key_type = Key |
| Stored key type. | |
Public Member Functions | |
| Gen_B_Tree (const Compare &cmp=Compare()) | |
| Construct an empty B-Tree. | |
| template<std::input_iterator It> | |
| Gen_B_Tree (It first, It last, const Compare &cmp=Compare()) | |
| Construct a B-Tree from an iterator range. | |
| Gen_B_Tree (std::initializer_list< Key > init, const Compare &cmp=Compare()) | |
| Construct a B-Tree from an initializer list. | |
| Gen_B_Tree (const Gen_B_Tree &other) | |
| Copy constructor performing a deep copy. | |
| Gen_B_Tree (Gen_B_Tree &&other)=default | |
| Move constructor. | |
| Gen_B_Tree & | operator= (const Gen_B_Tree &other) |
| Copy assignment. | |
| Gen_B_Tree & | operator= (Gen_B_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. | |
| Array< Key > | keys () const |
| Materialize the tree contents in sorted order. | |
| bool | verify () const |
| Verify structural B-Tree invariants. | |
Private Types | |
| using | Node = detail::BTreeNode< Key > |
Private Member Functions | |
| size_t | lower_bound_index (const Array< Key > &keys, const Key &key) const |
| size_t | upper_bound_index (const Array< Key > &keys, const Key &key) const |
| bool | equals (const Key &lhs, const Key &rhs) const |
| template<std::input_iterator It> | |
| void | insert_range (It first, It last) |
| std::unique_ptr< Node > | clone_node (const Node *node) const |
| size_t | height_of (const Node *node) const noexcept |
| bool | contains_in (const Node *node, const Key &key) const |
| void | split_child (Node *parent, const size_t idx) |
| void | insert_nonfull (Node *node, const Key &key) |
| std::optional< Key > | min_in (const Node *node) const |
| std::optional< Key > | max_in (const Node *node) const |
| void | borrow_from_prev (Node *parent, const size_t idx) |
| void | borrow_from_next (Node *parent, const size_t idx) |
| void | merge_children (Node *parent, const size_t idx) |
| size_t | ensure_child_has_extra (Node *parent, const size_t idx) |
| bool | remove_from (Node *node, const Key &key) |
| void | collect_keys (const Node *node, Array< Key > &out) const |
| bool | verify_node (const Node *node, const std::optional< Key > &min_key, const std::optional< Key > &max_key, const size_t depth, size_t &leaf_depth, size_t &counted) const |
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_B_Tree models an ordered set of unique keys. Unlike the raw binary-tree types in Aleph-w, this container owns its internal nodes and stores keys directly in them, which makes it a higher-level tree suited for page-like branching factors.
| 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. |
false. Compare and Key operations do not throw in the middle of internal node updates; allocation failures propagate as std::bad_alloc. Definition at line 133 of file tpl_b_tree.H.
| using Aleph::Gen_B_Tree< Key, Compare, MinDegree >::key_type = Key |
Stored key type.
Definition at line 554 of file tpl_b_tree.H.
|
private |
Definition at line 138 of file tpl_b_tree.H.
|
inlineexplicit |
Construct an empty B-Tree.
| cmp | Comparison functor used to sort keys. |
| Nothing. |
Definition at line 561 of file tpl_b_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 570 of file tpl_b_tree.H.
References Aleph::Gen_B_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 581 of file tpl_b_tree.H.
|
inline |
Copy constructor performing a deep copy.
| other | Tree to copy. |
| std::bad_alloc | if cloning internal nodes fails. |
Definition at line 590 of file tpl_b_tree.H.
|
default |
Move constructor.
| other | Tree to move from. |
|
inlinestaticprivate |
Definition at line 218 of file tpl_b_tree.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::merge_children(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child().
|
inlinestaticprivate |
Definition at line 225 of file tpl_b_tree.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::merge_children(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child().
|
inlineprivate |
Definition at line 369 of file tpl_b_tree.H.
References Aleph::Array< T >::append(), Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::erase_at(), Aleph::Array< T >::get_first(), Aleph::detail::BTreeNode< Key >::keys, and Aleph::detail::BTreeNode< Key >::leaf.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::ensure_child_has_extra().
|
inlineprivate |
Definition at line 353 of file tpl_b_tree.H.
References Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_last(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::detail::BTreeNode< Key >::keys, Aleph::detail::BTreeNode< Key >::leaf, and Aleph::Array< T >::remove_last().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::ensure_child_has_extra().
|
inlinenoexcept |
Remove every key from the tree.
| Nothing. |
Definition at line 688 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.
|
inlineprivate |
Definition at line 232 of file tpl_b_tree.H.
References Aleph::detail::BTreeNode< Key >::children, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::clone_node(), Aleph::copy(), Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BTreeNode< Key >::keys, Aleph::detail::BTreeNode< Key >::leaf, and Aleph::Array< T >::reserve().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::clone_node().
|
inlineprivate |
Definition at line 471 of file tpl_b_tree.H.
References Aleph::detail::BTreeNode< Key >::children, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::collect_keys(), Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BTreeNode< Key >::keys, Aleph::detail::BTreeNode< Key >::leaf, and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::collect_keys(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys().
|
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 700 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::search().
|
inlineprivate |
Definition at line 261 of file tpl_b_tree.H.
References Aleph::and, Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::equals(), Aleph::detail::BTreeNode< Key >::keys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains().
|
inlinenoexcept |
Return whether the tree has no keys.
true if empty, otherwise false. | Nothing. |
Definition at line 649 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::is_empty().
|
inlineprivate |
Definition at line 400 of file tpl_b_tree.H.
References Aleph::and, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::borrow_from_next(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::borrow_from_prev(), Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::merge_children().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inlineprivate |
Definition at line 175 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), and Aleph::detail::equiv().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inlinestaticprivate |
Definition at line 200 of file tpl_b_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_B_Tree< Key, Compare, MinDegree >::borrow_from_next(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::merge_children(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inlinenoexcept |
Return the comparison object (read-only).
| Nothing. |
Definition at line 639 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::key_comp().
|
inlinenoexcept |
Return the current tree height.
0 for an empty tree, otherwise the number of node levels. | Nothing. |
Definition at line 679 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height_of(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height_of().
|
inlineprivatenoexcept |
Definition at line 248 of file tpl_b_tree.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height().
Referenced by Aleph::Gen_B_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 723 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MaxKeys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_B_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 756 of file tpl_b_tree.H.
References Aleph::copy(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert().
|
inlinestaticprivate |
Definition at line 186 of file tpl_b_tree.H.
References Aleph::Array< T >::append(), Aleph::open_gap(), Aleph::Array< T >::putn(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::borrow_from_prev(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child().
|
inlineprivate |
Definition at line 296 of file tpl_b_tree.H.
References Aleph::detail::BTreeNode< Key >::children, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::detail::BTreeNode< Key >::keys, Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MaxKeys, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull().
|
inlineprivate |
Definition at line 180 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Gen_B_Tree().
|
inlinenoexcept |
Synonym for empty() in traditional Aleph style.
true if empty, otherwise false. | Nothing. |
Definition at line 659 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::empty().
|
inlinenoexcept |
Return the comparison object (read-only).
| Nothing. |
Definition at line 629 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_.
Referenced by Aleph::Gen_B_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 877 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::collect_keys(), Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::reserve(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains_in(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound_index(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
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 829 of file tpl_b_tree.H.
References Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BTreeNode< Key >::keys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Array< T >::size().
|
inlineprivate |
Definition at line 147 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains_in(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inlineprivate |
Definition at line 334 of file tpl_b_tree.H.
References Aleph::and, Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_last(), Aleph::Array< T >::is_empty(), Aleph::detail::BTreeNode< Key >::keys, and Aleph::detail::BTreeNode< Key >::leaf.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_key(), and Aleph::Gen_B_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 818 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivate |
Definition at line 385 of file tpl_b_tree.H.
References Aleph::Array< T >::append(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::append_copy_range(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::append_move_range(), Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::erase_at(), GenericItems< Container, T >::keys(), Aleph::detail::BTreeNode< Key >::keys, and Aleph::detail::BTreeNode< Key >::leaf.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::ensure_child_has_extra(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inlineprivate |
Definition at line 315 of file tpl_b_tree.H.
References Aleph::and, Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::get_first(), Aleph::Array< T >::is_empty(), Aleph::detail::BTreeNode< Key >::keys, and Aleph::detail::BTreeNode< Key >::leaf.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_key(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inline |
Return the minimum key, if any.
std::nullopt if empty. | Any | exception propagated by Key copy construction. |
Definition at line 808 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
inline |
Copy assignment.
| other | Tree to copy from. |
*this. Definition at line 603 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.
|
default |
Move assignment.
| other | Tree to move from. |
*this.
|
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 768 of file tpl_b_tree.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.
|
inlineprivate |
Definition at line 427 of file tpl_b_tree.H.
References ah_runtime_error_unless, Aleph::and, Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::ensure_child_has_extra(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::equals(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::erase_at(), Aleph::detail::BTreeNode< Key >::keys, Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_in(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::merge_children(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_in(), pred, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from().
|
inline |
Synonym for contains().
| key | Key to search. |
true if the key exists, otherwise false. | Any | exception propagated by Compare. |
Definition at line 711 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains().
|
inlinenoexcept |
Return the number of stored keys.
| Nothing. |
Definition at line 669 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.
|
inlineprivate |
Definition at line 276 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::append_copy_range(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::append_move_range(), Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::detail::BTreeNode< Key >::keys, Aleph::detail::BTreeNode< Key >::leaf, Aleph::median(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MinKeys, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::truncate().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull().
|
inlinestaticprivate |
Definition at line 212 of file tpl_b_tree.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::Array< T >::remove_last(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_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 853 of file tpl_b_tree.H.
References Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BTreeNode< Key >::keys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Array< T >::size(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound_index().
|
inlineprivate |
Definition at line 161 of file tpl_b_tree.H.
References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), and Aleph::Array< T >::size().
Referenced by Aleph::Gen_B_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 890 of file tpl_b_tree.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
inlineprivate |
Definition at line 491 of file tpl_b_tree.H.
References Aleph::and, Aleph::detail::BTreeNode< Key >::children, Aleph::Gen_B_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::BTreeNode< Key >::keys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_key(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MaxKeys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_key(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MinKeys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Array< T >::size(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
private |
Definition at line 145 of file tpl_b_tree.H.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::equals(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::key_comp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::operator=(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound_index(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
staticconstexprprivate |
Definition at line 140 of file tpl_b_tree.H.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
staticconstexprprivate |
Definition at line 141 of file tpl_b_tree.H.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
private |
Definition at line 143 of file tpl_b_tree.H.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::clear(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_key(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_key(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::operator=(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().
|
private |
Definition at line 144 of file tpl_b_tree.H.
Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::clear(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::empty(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::operator=(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify().