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

Top-down red-black tree with rank (no virtual destructor). More...

#include <tpl_tdRbTreeRk.H>

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

Private Types

using Base = GenTdRbTreeRk< RbNodeRk, Key, Compare >
 

Additional Inherited Members

- Public Types inherited from Aleph::GenTdRbTreeRk< NodeType, Key, Compare >
using Node = NodeType< Key >
 
using key_type = Key
 
using compare_type = Compare
 
- Public Member Functions inherited from Aleph::GenTdRbTreeRk< NodeType, Key, Compare >
 GenTdRbTreeRk () noexcept(std::is_nothrow_default_constructible_v< Node > and std::is_nothrow_default_constructible_v< Compare >)
 Builds an empty tree with a comparison criteria built by default.
 
 GenTdRbTreeRk (const Compare &__cmp) noexcept(std::is_nothrow_default_constructible_v< Node > and std::is_nothrow_copy_constructible_v< Compare >)
 Builds an empty tree with the comparison criteria __cmp.
 
 GenTdRbTreeRk (GenTdRbTreeRk &&other) 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 other, which is left empty and can take nodes again.
 
GenTdRbTreeRk & operator= (GenTdRbTreeRk &&other) noexcept(std::is_nothrow_move_assignable_v< Compare >)
 Takes the nodes and the comparison criteria of other, which is left empty.
 
 GenTdRbTreeRk (const GenTdRbTreeRk &)=delete
 
GenTdRbTreeRk & operator= (const GenTdRbTreeRk &)=delete
 
void reset () noexcept
 Reset tree (does not free nodes)
 
void swap (GenTdRbTreeRk &other) noexcept(std::is_nothrow_swappable_v< Compare >)
 Swaps in constant time the nodes and the comparison criteria of this and other.
 
virtual ~GenTdRbTreeRk ()=default
 
size_t size () const noexcept
 Get number of nodes O(1)
 
bool is_empty () const noexcept
 Check if empty.
 
Compare & get_compare () noexcept
 Get comparator.
 
const Compare & get_compare () const noexcept
 
Node * insert (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Insert a node.
 
Node * insert_dup (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Insert a node allowing duplicates.
 
Node * search_or_insert (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Search or insert.
 
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 root pointer.
 
Node * getRoot () const noexcept
 
Node * select (size_t i) const
 Select i-th node in order.
 
std::pair< long, Node * > position (const Key &key) const noexcept(nothrow_compare_copy_v< Compare, Key >)
 Find position of a key.
 
std::pair< long, Node * > find_position (const Key &key) const noexcept(nothrow_compare_copy_v< Compare, Key >)
 Find position of a key (even if not in tree).
 
Node * remove_pos (size_t i)
 Remove node at position i.
 
void split_pos (size_t pos, GenTdRbTreeRk &t1, GenTdRbTreeRk &t2) noexcept
 Split tree by position.
 
bool verify () const
 Verify tree properties. It throws what the comparator throws.
 
- Static Public Attributes inherited from Aleph::GenTdRbTreeRk< NodeType, Key, Compare >
static constexpr size_t PATH_STACK_CAPACITY = 128
 

Detailed Description

template<typename Key, class Compare = Aleph::less<Key>>
class Aleph::TdRbTreeRk< Key, Compare >

Top-down red-black tree with rank (no virtual destructor).

Template Parameters
KeyKey type.
CompareComparison functor.

Definition at line 1097 of file tpl_tdRbTreeRk.H.

Member Typedef Documentation

◆ Base

template<typename Key , class Compare = Aleph::less<Key>>
using Aleph::TdRbTreeRk< Key, Compare >::Base = GenTdRbTreeRk<RbNodeRk, Key, Compare>
private

Definition at line 1099 of file tpl_tdRbTreeRk.H.


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