Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::HtdRbTreeVtl< Key, Compare > Class Template Reference

Hybrid red-black tree with virtual node destructor. More...

#include <tpl_hRbTree.H>

Inheritance diagram for Aleph::HtdRbTreeVtl< Key, Compare >:
[legend]
Collaboration diagram for Aleph::HtdRbTreeVtl< Key, Compare >:
[legend]

Public Types

using Base = HtdRbTree< Key, Compare >
 
using Node = typename Base::Node
 
- Public Types inherited from Aleph::HtdRbTree< Key, Compare >
using Color = unsigned char
 Color type for red-black nodes.
 
using Node = RbNode< Key >
 The node type used by this tree.
 
using key_type = Key
 The key type stored in nodes.
 

Additional Inherited Members

- Public Member Functions inherited from Aleph::HtdRbTree< Key, Compare >
Compare & key_comp () noexcept
 Returns a reference to the comparison functor.
 
const Compare & key_comp () const noexcept
 
Compare & get_compare () noexcept
 Alias for key_comp()
 
constexpr const Compare & get_compare () const noexcept
 
 HtdRbTree () 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.
 
 HtdRbTree (Compare __cmp) 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.
 
void swap (HtdRbTree &tree) noexcept(std::is_nothrow_swappable_v< Compare >)
 Swaps in constant time the nodes and the comparison criteria of this and tree.
 
 HtdRbTree (HtdRbTree &&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.
 
HtdRbTree & operator= (HtdRbTree &&tree) noexcept(std::is_nothrow_swappable_v< Compare >)
 Swaps the nodes and the comparison criteria with tree.
 
 HtdRbTree (const HtdRbTree &)=delete
 Copy constructor deleted.
 
HtdRbTree & operator= (const HtdRbTree &)=delete
 Copy assignment deleted.
 
virtual ~HtdRbTree ()=default
 Virtual destructor.
 
constexpr bool is_empty () const noexcept
 Check if tree is empty.
 
constexpr size_t size () const noexcept
 Get number of nodes in tree.
 
void reset () noexcept
 Reset tree (does not free nodes)
 
Node * insert (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Insert a node into the tree.
 
Node * search_or_insert (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Search for key or insert if not found.
 
Node * insert_dup (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Insert allowing duplicate keys.
 
Node * search (const Key &key) const noexcept(nothrow_compare_v< Compare, Key >)
 Search for a key.
 
Node * remove (const Key &key) noexcept(nothrow_compare_v< Compare, Key >)
 Remove node with given key.
 
Node *& getRoot () noexcept
 Get reference to root pointer.
 
Node * getRoot () const noexcept
 Get root pointer (const)
 
bool verifyRedBlack () const noexcept
 Verify the red-black properties of every node.
 
bool verify () const
 Verify tree is a valid red-black BST.
 

Detailed Description

template<class Key, class Compare = Aleph::less<Key>>
requires StrictWeakOrder<Compare, Key>
class Aleph::HtdRbTreeVtl< Key, Compare >

Hybrid red-black tree with virtual node destructor.

Same as HtdRbTree but uses RbNodeVtl which has virtual destructor.

Definition at line 1113 of file tpl_hRbTree.H.

Member Typedef Documentation

◆ Base

template<class Key , class Compare = Aleph::less<Key>>
using Aleph::HtdRbTreeVtl< Key, Compare >::Base = HtdRbTree<Key, Compare>

Definition at line 1116 of file tpl_hRbTree.H.

◆ Node

template<class Key , class Compare = Aleph::less<Key>>
using Aleph::HtdRbTreeVtl< Key, Compare >::Node = typename Base::Node

Definition at line 1117 of file tpl_hRbTree.H.


The documentation for this class was generated from the following file: