|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Red-black tree with rank support (select/position operations). More...
#include <tpl_rbRk.H>
Classes | |
| class | Iterator |
| Iterator on nodes of the tree. More... | |
Public Types | |
| typedef NodeType< Key > | Node |
| typedef Key | key_type |
Public Member Functions | |
| Compare & | key_comp () noexcept |
| Compare & | get_compare () noexcept |
| Gen_Rb_Tree_Rk () noexcept(std::is_nothrow_default_constructible_v< Node > and std::is_nothrow_default_constructible_v< Compare > and std::is_nothrow_constructible_v< Compare, Compare & >) | |
| Builds an empty tree with a comparison criteria built by default. | |
| Gen_Rb_Tree_Rk (Compare cmp_arg) noexcept(std::is_nothrow_default_constructible_v< Node > and std::is_nothrow_constructible_v< Compare, Compare & >) | |
Builds an empty tree with the comparison criteria cmp_arg. | |
| void | swap (Gen_Rb_Tree_Rk &tree) noexcept(std::is_nothrow_swappable_v< Compare >) |
Swaps in constant time the nodes and the comparison criteria of this and tree. | |
| Gen_Rb_Tree_Rk (Gen_Rb_Tree_Rk &&tree) noexcept(bin_node_detail::nothrow_header_from_v< Node > and bin_node_detail::nothrow_compare_taken_v< Compare >) | |
Takes the nodes and the comparison criteria of tree, which is left empty and can take nodes again. | |
| Gen_Rb_Tree_Rk & | operator= (Gen_Rb_Tree_Rk &&tree) noexcept(std::is_nothrow_move_assignable_v< Compare >) |
Takes the nodes and the comparison criteria of tree, which is left empty. | |
| virtual | ~Gen_Rb_Tree_Rk ()=default |
| Node * | search (const Key &key) |
| Node *& | getRoot () noexcept |
| bool | is_empty () const noexcept |
| size_t | size () const noexcept |
| Node * | insert (Node *p) |
| Node * | search_or_insert (Node *p) |
| Node * | insert_dup (Node *p) |
| bool | verify () const |
| Node * | remove (const Key &key) |
| Node * | select (const size_t i) const |
| Return the i-th node in order sense. | |
| std::pair< long, Node * > | position (const Key &key) const noexcept(nothrow_compare_copy_v< Compare, Key >) |
| Compute the inorder position of a key. | |
| std::pair< long, Node * > | find_position (const Key &key) const noexcept(nothrow_compare_copy_v< Compare, Key >) |
| Find the inorder position of a key in the tree. | |
| void | join_exclusive (Gen_Rb_Tree_Rk &t) noexcept |
| Join this tree exclusively with another tree. | |
| Node * | split_key (const Key &key, Gen_Rb_Tree_Rk &t1, Gen_Rb_Tree_Rk &t2) noexcept |
| Split tree by key. | |
| void | split_key_dup (const Key &key, Gen_Rb_Tree_Rk &t1, Gen_Rb_Tree_Rk &t2) noexcept |
| Split tree by key including duplicates. | |
| void | split_pos (size_t pos, Gen_Rb_Tree_Rk &t1, Gen_Rb_Tree_Rk &t2) noexcept |
| Split tree by inorder position. | |
Private Types | |
| using | Path = InlineStack< Node *, Node::MaxHeight+1 > |
Private Member Functions | |
| Node * | search_and_stack_rb (const Key &key, signed char &cmp_result, Path &path) |
| Search for key and stack ancestors (optimistic duplicate detection). | |
| Node * | search_dup_and_stack_rb (const Key &key, signed char &cmp_result, Path &path) |
| Node * | rotate_to_right_rk (Node *p, Node *pp) noexcept |
| Node * | rotate_to_left_rk (Node *p, Node *pp) noexcept |
| void | fix_red_condition (Node *p, Path &path) |
| void | find_succ_and_swap (Node *p, Node *&pp, Path &path) |
| void | fix_black_condition (Node *p, Path &path) |
| void | update_counters_after_insertion (const Path &path) noexcept |
| void | update_counters_after_deletion (const Path &path) noexcept |
| Node * | split_key_rec_rb (Node *p, const Key &key, Node *&t1, Node *&t2) noexcept(nothrow_compare_v< Compare, Key >) |
| void | split_key_dup_rec_rb (Node *p, const Key &key, Node *&t1, Node *&t2) noexcept(nothrow_compare_v< Compare, Key >) |
| void | split_pos_rec_rb (Node *p, size_t pos, Node *&t1, Node *&t2) noexcept |
Static Private Member Functions | |
| static size_t | black_height (Node *p) noexcept |
| static Node * | rotate_right_simple (Node *p) noexcept |
| static Node * | rotate_left_simple (Node *p) noexcept |
| static void | fix_red_violation (Node *&subtree_root) noexcept |
| static Node * | extract_min_rb (Node *&p) noexcept |
| static Node * | extract_max_rb (Node *&p) noexcept |
| static Node * | join_with_pivot_rb (Node *t1, size_t bh1, Node *pivot, Node *t2, size_t bh2) noexcept |
| static Node * | join_right_rb (Node *t1, size_t bh1, Node *pivot, Node *t2, size_t bh2) noexcept |
| static Node * | join_left_rb (Node *t1, size_t bh1, Node *pivot, Node *t2, size_t bh2) noexcept |
| static Node * | join_exclusive_rec_rb (Node *t1, size_t bh1, Node *t2, size_t bh2) noexcept |
Private Attributes | |
| Node | head_node |
| Node * | head |
| Node *& | root |
| Compare | cmp |
Static Private Attributes | |
| static constexpr signed char | CmpLess = -1 |
| static constexpr signed char | CmpEqual = 0 |
| static constexpr signed char | CmpGreater = 1 |
Red-black tree with rank support (select/position operations).
This class extends the standard red-black tree with subtree size counts, enabling efficient O(log n) rank-based operations:
count field representing the number of nodes in its subtree (including itself). Rotations update these counts to maintain the invariant. This adds O(1) overhead per rotation but enables O(log n) ranked operations.| NodeType | Node template (RbNodeRk or RbNodeRkVtl). |
| Key | The type of keys stored in the tree. |
| Compare | Comparison functor for ordering keys. |
Definition at line 109 of file tpl_rbRk.H.
| typedef Key Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::key_type |
Definition at line 469 of file tpl_rbRk.H.
| typedef NodeType<Key> Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::Node |
Definition at line 113 of file tpl_rbRk.H.
|
private |
Definition at line 129 of file tpl_rbRk.H.
|
inlinenoexcept |
Builds an empty tree with a comparison criteria built by default.
It is a constructor apart from the one that takes the comparison, and not a default argument of that one: GCC and Clang do not count a default argument in the noexcept of the implicit default constructor of a tree that inherits these, and what the construction of the comparison threw would end the program there.
| what | the default construction of the key of a header node or of the comparison, or the copy of the comparison, throws; nothing when they are noexcept. |
Definition at line 488 of file tpl_rbRk.H.
|
inlinenoexcept |
Builds an empty tree with the comparison criteria cmp_arg.
| [in] | cmp_arg | the comparison criteria, which the tree copies. |
| what | the default construction of the key of a header node or the copy of cmp_arg throws; nothing when both are noexcept. The copy is from a Compare that is not const, which a comparison may have apart from the one from a const one. |
Definition at line 505 of file tpl_rbRk.H.
|
inlinenoexcept |
Takes the nodes and the comparison criteria of tree, which is left empty and can take nodes again.
It builds no key, if it can: the key of the header node is built by default when that cannot throw; else it is that of the header node of tree, moved, when the move of a key cannot throw (see bin_node_detail::header_from()).
| [in,out] | tree | the tree to move from. It keeps its comparison criteria, which are copied: from a const one, or from one that is not const, if they have only that copy. Criteria that cannot be copied are moved, and tree keeps criteria that were moved from. |
| what | the copy of the comparison criteria throws, or their move if they cannot be copied; and what the default construction of the key of the header node throws, with a key whose move may throw too. Then tree keeps its nodes. Nothing when they are noexcept. |
Definition at line 544 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
|
virtualdefault |
|
inlinestaticprivatenoexcept |
Definition at line 764 of file tpl_rbRk.H.
References BLACK, COLOR, h, and LLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_rec_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos_rec_rb().
|
inlinestaticprivatenoexcept |
Definition at line 958 of file tpl_rbRk.H.
References Aleph::and, BLACK, COLOR, Aleph::COUNT(), LLINK, RED, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec_rb().
|
inlinestaticprivatenoexcept |
Definition at line 857 of file tpl_rbRk.H.
References Aleph::and, BLACK, COLOR, Aleph::COUNT(), LLINK, RED, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec_rb().
|
inlinenoexcept |
Find the inorder position of a key in the tree.
| [in] | key | to be searched |
| anything | that the comparison or its copy throws; the search does not modify the tree, so it is left as it was. |
noexcept only if the comparison and its copy cannot throw, so that what it throws reaches the caller. Definition at line 750 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::find_position(), r, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::find_position().
|
inlineprivate |
Definition at line 308 of file tpl_rbRk.H.
References COLOR, Aleph::COUNT(), LLINK, Aleph::InlineStack< T, N >::push(), RLINK, and Aleph::InlineStack< T, N >::top().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::remove().
|
inlineprivate |
Definition at line 353 of file tpl_rbRk.H.
References BLACK, COLOR, LLINK, Aleph::InlineStack< T, N >::pop(), Aleph::InlineStack< T, N >::popn(), RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_to_left_rk(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_to_right_rk(), and Aleph::InlineStack< T, N >::top().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::remove().
|
inlineprivate |
Definition at line 249 of file tpl_rbRk.H.
References Aleph::and, BLACK, COLOR, LLINK, Aleph::InlineStack< T, N >::pop(), RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_to_left_rk(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_to_right_rk().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inlinestaticprivatenoexcept |
Definition at line 799 of file tpl_rbRk.H.
References Aleph::and, BLACK, COLOR, l, LLINK, r, RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_left_simple(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_right_simple().
|
inlinenoexcept |
Definition at line 473 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::key_comp().
|
inlinenoexcept |
Definition at line 583 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST().
|
inline |
Definition at line 589 of file tpl_rbRk.H.
References Aleph::and, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpEqual, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpGreater, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpLess, COLOR, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition(), KEY, LLINK, RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_exclusive(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().
|
inline |
Definition at line 637 of file tpl_rbRk.H.
References Aleph::and, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpEqual, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpLess, COLOR, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition(), KEY, LLINK, RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
|
inlinenoexcept |
|
inlinenoexcept |
Join this tree exclusively with another tree.
All keys in this tree must be less than all keys in t. After the operation, t becomes empty and this tree contains all nodes.
| [in,out] | t | tree to join with (will be empty after) |
std::terminate()). noexcept because it inserts the nodes of t one by one: a comparison that threw in the middle would leave nodes out of both trees. Definition at line 1420 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::InlineStack< T, N >::is_empty(), LLINK, Aleph::InlineStack< T, N >::pop(), Aleph::InlineStack< T, N >::push(), RLINK, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
|
inlinestaticprivatenoexcept |
Definition at line 1211 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::black_height(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::extract_max_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::extract_min_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_with_pivot_rb().
|
inlinestaticprivatenoexcept |
Definition at line 1146 of file tpl_rbRk.H.
References Aleph::and, BLACK, COLOR, Aleph::COUNT(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_left_rb(), LLINK, RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_left_simple(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_right_simple().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_left_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_with_pivot_rb().
|
inlinestaticprivatenoexcept |
Definition at line 1075 of file tpl_rbRk.H.
References Aleph::and, BLACK, COLOR, Aleph::COUNT(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_right_rb(), LLINK, RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_left_simple(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::rotate_right_simple().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_right_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_with_pivot_rb().
|
inlinestaticprivatenoexcept |
Definition at line 1052 of file tpl_rbRk.H.
References COLOR, Aleph::COUNT(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_left_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_right_rb(), LLINK, RED, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_rec_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos_rec_rb().
|
inlinenoexcept |
Definition at line 471 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::get_compare().
|
inlinenoexcept |
Takes the nodes and the comparison criteria of tree, which is left empty.
| [in,out] | tree | the tree to move from. |
*this. | what | the move assignment of the comparison criteria throws, which goes first: then the nodes stay where they were. |
Definition at line 562 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Compute the inorder position of a key.
| [in] | key | to be searched |
| anything | that the comparison or its copy throws; the search does not modify the tree, so it is left as it was. |
noexcept only if the comparison and its copy cannot throw, so that what it throws reaches the caller. Definition at line 730 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::inorder_position(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
|
inline |
Definition at line 661 of file tpl_rbRk.H.
References BLACK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpEqual, COLOR, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::find_succ_and_swap(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_black_condition(), LLINK, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::InlineStack< T, N >::top(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::update_counters_after_deletion().
|
inlinestaticprivatenoexcept |
Definition at line 787 of file tpl_rbRk.H.
References Aleph::COUNT(), LLINK, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_violation(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_left_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_right_rb().
|
inlinestaticprivatenoexcept |
Definition at line 777 of file tpl_rbRk.H.
References Aleph::COUNT(), LLINK, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_violation(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_left_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_right_rb().
|
inlineprivatenoexcept |
Definition at line 227 of file tpl_rbRk.H.
References Aleph::COUNT(), LLINK, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_black_condition(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition().
|
inlineprivatenoexcept |
Definition at line 204 of file tpl_rbRk.H.
References Aleph::COUNT(), LLINK, and RLINK.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_black_condition(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition().
|
inline |
Definition at line 577 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST().
|
inlineprivate |
Search for key and stack ancestors (optimistic duplicate detection).
It only reads the tree, so it lets through what the comparison throws, as the operations that call it do.
Definition at line 134 of file tpl_rbRk.H.
References Aleph::and, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpEqual, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpGreater, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpLess, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::head, KEY, LLINK, Aleph::InlineStack< T, N >::popn(), Aleph::InlineStack< T, N >::push(), RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::InlineStack< T, N >::size(), and Aleph::InlineStack< T, N >::top().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::remove(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inlineprivate |
Definition at line 177 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpEqual, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpGreater, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpLess, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::head, KEY, LLINK, Aleph::InlineStack< T, N >::push(), RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::InlineStack< T, N >::top().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup().
|
inline |
Definition at line 613 of file tpl_rbRk.H.
References Aleph::and, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpEqual, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpGreater, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::CmpLess, COLOR, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition(), KEY, LLINK, RED, RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
Referenced by TEST().
|
inline |
Return the i-th node in order sense.
| [in] | i | inorder position of node to be selected |
| out_of_range | if i is greater or equal than the number of nodes of tree |
Definition at line 715 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::select().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().
|
inlinenoexcept |
Definition at line 587 of file tpl_rbRk.H.
References Aleph::COUNT(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().
|
inlinenoexcept |
Split tree by key.
After the operation:
| [in] | key | the splitting key |
| [out] | t1 | tree to receive keys < key |
| [out] | t2 | tree to receive keys > key |
std::terminate()). noexcept because it moves the nodes one by one: a comparison that threw in the middle would leave nodes out of every tree. Definition at line 1473 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::InlineStack< T, N >::is_empty(), KEY, LLINK, Aleph::InlineStack< T, N >::pop(), Aleph::InlineStack< T, N >::push(), RLINK, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Split tree by key including duplicates.
After the operation:
| [in] | key | the splitting key |
| [out] | t1 | tree to receive keys <= key |
| [out] | t2 | tree to receive keys > key |
std::terminate()). noexcept because it moves the nodes one by one: a comparison that threw in the middle would leave nodes out of every tree. Definition at line 1526 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::InlineStack< T, N >::is_empty(), KEY, LLINK, Aleph::InlineStack< T, N >::pop(), Aleph::InlineStack< T, N >::push(), RLINK, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST().
|
inlineprivatenoexcept |
Definition at line 1308 of file tpl_rbRk.H.
References BLACK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::black_height(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, COLOR, Aleph::COUNT(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_with_pivot_rb(), KEY, LLINK, RED, RLINK, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec_rb().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec_rb().
|
inlineprivatenoexcept |
Definition at line 1243 of file tpl_rbRk.H.
References BLACK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::black_height(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, COLOR, Aleph::COUNT(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_with_pivot_rb(), KEY, LLINK, RED, RLINK, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_rec_rb().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_rec_rb().
|
inlinenoexcept |
Split tree by inorder position.
After the operation:
| [in] | pos | the splitting position (0-based) |
| [out] | t1 | tree to receive positions [0, pos) |
| [out] | t2 | tree to receive positions [pos, size) |
std::terminate()). noexcept because it inserts the nodes one by one in t1 and t2, which compares: a comparison that threw in the middle would leave nodes out of every tree. Definition at line 1573 of file tpl_rbRk.H.
References Aleph::count(), Aleph::InlineStack< T, N >::is_empty(), LLINK, Aleph::InlineStack< T, N >::pop(), Aleph::InlineStack< T, N >::push(), RLINK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::size().
|
inlineprivatenoexcept |
Definition at line 1357 of file tpl_rbRk.H.
References BLACK, Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::black_height(), COLOR, Aleph::COUNT(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_with_pivot_rb(), LLINK, RED, RLINK, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos_rec_rb().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos_rec_rb().
|
inlinenoexcept |
Swaps in constant time the nodes and the comparison criteria of this and tree.
| [in,out] | tree | the tree to swap with. |
| what | the swap of the comparison criteria throws, which goes first: then the nodes stay where they were. |
Definition at line 519 of file tpl_rbRk.H.
References Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
|
inlineprivatenoexcept |
Definition at line 460 of file tpl_rbRk.H.
References Aleph::COUNT().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::remove().
|
inlineprivatenoexcept |
Definition at line 450 of file tpl_rbRk.H.
References Aleph::COUNT().
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inline |
Definition at line 659 of file tpl_rbRk.H.
References Aleph::and, Aleph::check_rank_tree(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::is_red_black_bst_rk(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
private |
Definition at line 120 of file tpl_rbRk.H.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::find_position(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::key_comp(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::operator=(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::position(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_rec_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::swap(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::verify().
|
staticconstexprprivate |
Definition at line 122 of file tpl_rbRk.H.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::remove(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
staticconstexprprivate |
Definition at line 123 of file tpl_rbRk.H.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
staticconstexprprivate |
Definition at line 121 of file tpl_rbRk.H.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
private |
Definition at line 118 of file tpl_rbRk.H.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb().
|
private |
Definition at line 117 of file tpl_rbRk.H.
|
private |
Definition at line 119 of file tpl_rbRk.H.
Referenced by Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::Gen_Rb_Tree_Rk(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::find_position(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_black_condition(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::getRoot(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::is_empty(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_exclusive(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::operator=(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::position(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::remove(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::select(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::size(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_key_dup(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::swap(), and Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::verify().