|
HAllocator
A Simple C++ Memory Allocator
|
Template wrapper for managing a Red-Black tree. More...
#include <RBTreeDriver.hpp>
Public Member Functions | |
| RBTreeDriver () | |
| Default constructor - creates an empty tree. | |
| RBTreeDriver (T *node) | |
| Constructor with existing root node. | |
| RBTreeDriver (const RBTreeDriver &)=delete | |
| Copy constructor - deleted (move-only semantics). | |
| RBTreeDriver & | operator= (const RBTreeDriver &)=delete |
| Copy assignment - deleted (move-only semantics). | |
| RBTreeDriver (RBTreeDriver &&other) | |
| Move constructor - transfers ownership of tree. | |
| RBTreeDriver & | operator= (RBTreeDriver &&other) |
| Move assignment - transfers ownership of tree. | |
| void | insert (T *node) |
| Inserts a node into the RB-tree. | |
| void | remove (T *node) |
| Removes a node from the RB-tree. | |
| T * | lower_bound (std::size_t key, bool(*cmp)(std::size_t, std::size_t)) |
| Finds the smallest node with value >= key using custom comparison. | |
Template wrapper for managing a Red-Black tree.
This class provides a convenient interface for RB-tree operations while maintaining ownership of the root pointer. It enforces move-only semantics to prevent accidental tree duplication.
| T | Node type (must have fields: value, left, right, parent) |
|
inlineexplicit |
Default constructor - creates an empty tree.
|
inlineexplicit |
Constructor with existing root node.
| node | Pointer to existing RB-tree root |
|
delete |
Copy constructor - deleted (move-only semantics).
|
inline |
Move constructor - transfers ownership of tree.
| other | Source driver (will be left with nullptr root) |
|
inline |
Inserts a node into the RB-tree.
Delegates to hh::rb_tree::insert, which handles:
| node | Node to insert (must not already be in tree) |
|
inline |
Finds the smallest node with value >= key using custom comparison.
Delegates to hh::rb_tree::lower_bound for efficient search.
| key | Search key |
| cmp | Comparison function: returns true if first >= second |
|
delete |
Copy assignment - deleted (move-only semantics).
|
inline |
Move assignment - transfers ownership of tree.
| other | Source driver (will be left with nullptr root) |
|
inline |
Removes a node from the RB-tree.
Delegates to hh::rb_tree::remove, which handles:
| node | Node to remove (must be in tree) |