7 #include "size_holder.hpp" 8 #include "tree_iterator.hpp" 13 #include <type_traits> 35 template <
class Node,
class Options = DefaultOptions,
class Tag =
int>
39 void swap_parent_with(Node * other) noexcept;
54 template <
class Node,
class Tree>
56 leaf_inserted(Node & node, Tree & t) noexcept
62 template <
class Node,
class Tree>
64 rotated_left(Node & node, Tree & t) noexcept
70 template <
class Node,
class Tree>
72 rotated_right(Node & node, Tree & t) noexcept
78 template <
class Node,
class Tree>
80 delete_leaf(Node & node, Tree & t) noexcept
86 template <
class Node,
class Tree>
88 splice_out_left_knee(Node & node, Tree & t) noexcept
94 template <
class Node,
class Tree>
96 splice_out_right_knee(Node & node, Tree & t) noexcept
102 template <
class Node,
class Tree>
104 deleted_below(Node & node, Tree & t) noexcept
110 template <
class Node,
class Tree>
112 swapped(Node & old_ancestor, Node & old_descendant, Tree & t) noexcept
115 (void)old_descendant;
140 template <
class Node,
class NodeTraits,
class Options = DefaultOptions,
141 class Tag = int,
class Compare = ygg::utilities::flexible_less>
148 static_assert(std::is_base_of<NB, Node>::value,
149 "Node class not properly derived from WBTreeNodeBase");
170 template <
bool reverse>
171 using iterator =
typename TB::template iterator<reverse>;
172 template <
bool reverse>
173 using const_iterator =
typename TB::template const_iterator<reverse>;
189 void insert(Node & node) CMP_NOEXCEPT(node);
192 void insert_left_leaning(Node & node) CMP_NOEXCEPT(node);
193 void insert_right_leaning(Node & node) CMP_NOEXCEPT(node);
216 template <
class Comparable>
217 utilities::select_type_t<size_t, Node *, Options::stl_erase>
218 erase(
const Comparable & c) CMP_NOEXCEPT(c);
234 template <
bool reverse>
235 utilities::select_type_t<const iterator<reverse>, Node *, Options::stl_erase>
236 erase(
const iterator<reverse> & it) CMP_NOEXCEPT(*it);
239 template <
class Comparable>
240 Node * erase_optimistic(
const Comparable & c) CMP_NOEXCEPT(c);
249 void remove(Node & node) CMP_NOEXCEPT(node);
253 bool verify_integrity()
const;
257 void dbg_verify()
const;
258 size_t dbg_count_violations(std::vector<size_t> * depths =
nullptr,
259 std::vector<size_t> * amounts =
nullptr)
const;
260 void dbg_assert_balance_at(Node * n)
const;
264 template <
bool fix_upward>
265 void remove_onepass(Node & node) CMP_NOEXCEPT(node);
266 void remove_to_leaf(Node & node) CMP_NOEXCEPT(node);
267 void fixup_after_delete(Node * parent,
bool deleted_left)
268 CMP_NOEXCEPT(*parent);
270 template <
bool call_fixup>
271 bool remove_swap_and_remove_left(Node * node, Node * replacement)
273 template <
bool call_fixup>
274 bool remove_swap_and_remove_right(Node * node, Node * replacement)
276 template <
bool call_fixup>
277 void remove_leaf(Node * node) CMP_NOEXCEPT(*node);
279 template <
bool on_equality_prefer_left>
280 void insert_leaf_base_twopass(Node & node, Node * start) CMP_NOEXCEPT(node);
281 void fixup_after_insert_twopass(Node * node) CMP_NOEXCEPT(*node);
283 template <
bool on_equality_prefer_left>
284 void insert_leaf_onepass(Node & node) CMP_NOEXCEPT(node);
286 void rotate_left(Node * parent) noexcept;
287 void rotate_right(Node * parent) noexcept;
289 void swap_nodes(Node * n1, Node * n2) noexcept;
290 void replace_node(Node * to_be_replaced, Node * replace_with) noexcept;
291 void swap_unrelated_nodes(Node * n1, Node * n2) noexcept;
292 void swap_neighbors(Node * parent, Node * child) noexcept;
294 void verify_sizes()
const;
299 #ifndef YGG_WBTREE_CPP 300 #include "wbtree.cpp" 303 #endif // YGG_WBTREE_HPP
Helper base class for the NodeTraits you need to implement for the weight balanced tree...
Definition: wbtree.hpp:51
Base class (template) to supply your node class with metainformation.
Definition: wbtree.hpp:36
The Weight Balanced Tree.
Definition: wbtree.hpp:142
Definition: rbtree.hpp:18