26template <
class TItem,
class TAlloc>
75template <
class TKey,
class TItem,
class TKeyComp,
class TAlloc>
77 avl_node<TItem, TAlloc>> {
102 void clone_tree(
const avl_tree &other);
120 inline bool is_leaf(
node_ptr node)
const noexcept {
121 return node->right ==
nullptr && node->left ==
nullptr;
128 inline bool is_right_child(
node_ptr node)
const noexcept {
129 return node->parent->right == node;
147 avl_tree(
const avl_tree &other);
150 avl_tree &
operator=(
const avl_tree &other);
153 avl_tree(avl_tree &&other)
noexcept;
156 avl_tree &
operator=(avl_tree &&other)
noexcept;
208 template <
bool lower>
220 void clear() noexcept;
246 template <class TInsertCallback, class TAssignCallback>
248 TInsertCallback &&insert_callback,
249 TAssignCallback &&assign_callback);
269 template <class TInsertCallback>
271 TInsertCallback &&insert_callback) {
272 return insert(key, std::forward<TInsertCallback>(insert_callback),
318 std::string
to_dot(
bool print_invis)
const;
Implementation of the ethereal AVL tree.
Header for functions and classes common to all avl trees.
Base class for avl trees.
Definition _avl_common.hpp:76
TKey key_type
Definition _avl_common.hpp:78
TItem item_type
Definition _avl_common.hpp:79
avl_node_ptr< node_type, allocator_type > node_ptr
The node pointer type.
Definition _avl_common.hpp:90
TKeyComp comparator_type
Definition _avl_common.hpp:80
TAlloc allocator_type
Definition _avl_common.hpp:81
comparator_type comparator
Definition _avl_common.hpp:105
node_alloc_type allocator
Definition _avl_common.hpp:106
typename node_alloc_traits::size_type size_type
The size type.
Definition _avl_common.hpp:100
AVL tree implementation.
Definition _avl.hpp:77
base::size_type size() const noexcept
Returns the current number of nodes.
Definition _avl.hpp:290
typename base::node_ptr node_ptr
Definition _avl.hpp:83
~avl_tree() noexcept
Destroys the tree.
Definition _avl.ipp:72
void clear() noexcept
Erases the whole tree.
Definition _avl.ipp:258
node_ptr successor(node_ptr node) const noexcept
Returns the successor to the node.
Definition _avl.ipp:180
std::pair< node_ptr, bool > insert(const key_type &key, TInsertCallback &&insert_callback, TAssignCallback &&assign_callback)
Inserts an item to the tree.
int get_height() const
Returns the current height of the tree.
Definition _avl.ipp:558
node_ptr get_root() const noexcept
Returns the trees root.
Definition _avl.hpp:168
std::string to_dot(bool print_invis) const
Returns the dot representation of the tree.
Definition _avl.ipp:589
node_ptr find(const key_type &key) const noexcept
Finds a node with the given key, if there isn't any returns a nullptr.
Definition _avl.ipp:158
void erase(node_ptr node) noexcept
Erases the node.
Definition _avl.ipp:387
node_ptr predecessor(node_ptr node) const noexcept
Returns the predecessor to the node.
Definition _avl.ipp:201
avl_tree & operator=(const avl_tree &other)
Copies another tree.
Definition _avl.ipp:37
node_ptr bound(const key_type &key) const noexcept
A 2-in-1 function for both lower and upper bounds accessing.
Definition _avl.ipp:223
typename base::key_type key_type
Definition _avl.hpp:84
int8_t avl_sign_type
The type to use for the trinary sign value for each node.
Definition _avl_common.hpp:50
std::allocator_traits< avl_node_allocator_type< TNode, TAlloc > >::pointer avl_node_ptr
A node pointer type.
Definition _avl_common.hpp:72
Declarations of the persistent map.
Definition _avl.hpp:14
AVL Tree Node.
Definition _avl.hpp:27
avl_sign_type sign
Determines whether the node is leaning to one side or balanced.
Definition _avl.hpp:34
avl_node_ptr< avl_node, TAlloc > left
The left sub-tree.
Definition _avl.hpp:43
avl_node_ptr< avl_node, TAlloc > parent
The parent node.
Definition _avl.hpp:40
TItem item
The key / key, value pair.
Definition _avl.hpp:29
avl_node_ptr< avl_node, TAlloc > right
The right sub-tree.
Definition _avl.hpp:46