|
datastructures 0.1.0
|
Base class for avl trees. More...
#include <_avl_common.hpp>

Public Types | |
| using | key_type = TKey |
| using | item_type = TItem |
| using | comparator_type = TKeyComp |
| using | allocator_type = TAlloc |
| using | node_type = TNode |
| using | node_alloc_type = avl_node_allocator_type< node_type, allocator_type > |
| The node allocator type. | |
| using | node_ptr = avl_node_ptr< node_type, allocator_type > |
| The node pointer type. | |
| using | node_alloc_traits = std::allocator_traits< node_alloc_type > |
| Node allocator traits. | |
| using | size_type = typename node_alloc_traits::size_type |
| The size type. | |
Public Member Functions | |
| avl_tree_base (const comparator_type &comparator, const allocator_type &allocator) | |
| avl_tree_base (comparator_type &&comparator, allocator_type &&allocator) noexcept | |
| virtual | ~avl_tree_base ()=0 |
| node_alloc_type | get_allocator () const noexcept |
| Returns the associated allocator. | |
Static Public Member Functions | |
| static node_ptr | min_from (node_ptr node) noexcept |
| Finds the minimum value starting at the given node. | |
| static node_ptr | max_from (node_ptr node) noexcept |
| Finds the maximum value starting at the given node. | |
Protected Types | |
| using | sign_type = avl_sign_type |
Protected Member Functions | |
| template<class T > requires (!std::is_invocable_v<T>) | |
| node_ptr | create_node (T &&item) |
| Constructs a new node with the given item. | |
| template<class TCallback > requires std::is_invocable_v<TCallback> | |
| node_ptr | create_node (TCallback &&callback) |
Constructs a new node with the item being the result of callback(). | |
| void | destroy_node (node_ptr node) noexcept |
| Destroys the node and frees the memory. | |
Protected Attributes | |
| comparator_type | comparator |
| node_alloc_type | allocator |
Base class for avl trees.
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::allocator_type = TAlloc |
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::comparator_type = TKeyComp |
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::item_type = TItem |
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::key_type = TKey |
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::node_alloc_traits = std::allocator_traits<node_alloc_type> |
Node allocator traits.
Defined here so that I don't have to write so much raven brackets.
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::node_alloc_type = avl_node_allocator_type<node_type, allocator_type> |
The node allocator type.
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::node_ptr = avl_node_ptr<node_type, allocator_type> |
The node pointer type.
Can be also a fancy pointer depending on the allocator type.
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::node_type = TNode |
|
protected |
| using datastructures::detail::avl_tree_base< TKey, TItem, TKeyComp, TAlloc, TNode >::size_type = typename node_alloc_traits::size_type |
The size type.
Usually will be set to std::size_t.
|
inline |
|
inlinenoexcept |
|
pure virtualdefault |
|
protected |
Constructs a new node with the given item.
Perfectly forwards the item to the constructor.
In the case of an exception during the construction, the allocated memory will be freed (Strong exception guarantee).
|
protected |
Constructs a new node with the item being the result of callback().
The item will be perfectly forwarded. In the case of an exception during the construction, the allocated memory will be freed (strong exception guarantee).
|
protectednoexcept |
Destroys the node and frees the memory.
|
inlinenoexcept |
Returns the associated allocator.
|
staticnoexcept |
Finds the maximum value starting at the given node.
Returns a maximum value from a subtree of this tree, with the subtrees root being the given node.
You can call this even on a nullptr, in that case a nullptr will be returned.
| node | The root of the subtree to search in. |
|
staticnoexcept |
Finds the minimum value starting at the given node.
Returns a minimum value from a subtree of this tree, with the subtrees root being the given node.
You can call this even on a nullptr, in that case a nullptr will be returned.
| node | The root of the subtree to search in. |
|
protected |
|
protected |