#include <rb_tree.h>
Classes | |
class | Iterator |
struct | Node |
Public Types | |
enum | Color { kRed, kBlack } |
using | BasicIterator = Iterator< ValueType &, ValueType * > |
using | ConstIterator = Iterator< const ValueType &, const ValueType * > |
Public Member Functions | |
RBTree (KeyComp comp={}) | |
RBTree (const RBTree &other) | |
RBTree (RBTree &&other) | |
RBTree & | operator= (const RBTree &rhs) |
RBTree & | operator= (RBTree &&rhs) |
void | clear () |
BasicIterator | begin () |
ConstIterator | begin () const |
BasicIterator | end () |
ConstIterator | end () const |
BasicIterator | lowerBound (const Key &key) |
ConstIterator | lowerBound (const Key &key) const |
BasicIterator | upperBound (const Key &key) |
ConstIterator | upperBound (const Key &key) const |
BasicIterator | erase (BasicIterator it) |
BasicIterator | erase (BasicIterator first, BasicIterator last) |
BasicIterator | insert (const ValueType &val) |
BasicIterator | insert (BasicIterator start, const ValueType &val) |
size_t | size () const |
bool | isEmpty () const |
Red-black tree implementation with insertion and deletion algorithms based on the ones found in Introduction to Algorithms by Cormen, Leiserson, Rivest and Stein. Used in the implementation of Common::StableMap and Common::MultiMap
using Common::RBTree< ValueType, Key, KeyProj, KeyComp >::BasicIterator = Iterator<ValueType &, ValueType *> |
RBTree iterator.
using Common::RBTree< ValueType, Key, KeyProj, KeyComp >::ConstIterator = Iterator<const ValueType &, const ValueType *> |
Const-qualified RBTree iterator.
|
inline |
Construct an RBTree as a copy of the given tree other
.
|
inline |
Construct an RBTree by moving the contents of the given tree (using the C++11 move semantics).
|
inline |
Assign the given tree to this tree.
|
inline |
Moves the contents of the given tree into this tree (using the C++11 move semantics).
|
inline |
Clears the contents of the tree.
|
inline |
Return an iterator pointing to the first element in the tree.
|
inline |
Return a const iterator pointing to the first element of the tree.
|
inline |
Return an iterator pointing to the last element in the tree.
|
inline |
Return a const iterator pointing to the last element of the tree.
|
inline |
Returns an iterator to the first item thas is not less than key
in the tree (or end() if this cannot be found).
|
inline |
Returns a const iterator to the first item thas is not less than key
in the tree (or end() if this cannot be found).
|
inline |
Returns an iterator to the first item bigger than key
in the tree (or end() if this cannot be found).
|
inline |
Return a const iterator to the first item bigger than key
in the tree (or end() if this cannot be found).
|
inline |
Erases the item in the tree pointed by it
.
|
inline |
Erase the elements from first
to last
and return an iterator pointing to the next element in the tree.
|
inline |
Inserts a value val
into the tree returning an iterator for the inserted value.
|
inline |
Inserts the element val
starting from start
instead of the tree's root. This operations is meant for efficient insertions after a call to lowerBound. For example:
inserts 'value' if its not contained in 'tree' (assumes that key and value type are the same)
start
is not the lower bound, or it's not end(), the resulting tree could be unsorted.
|
inline |
Returns the number of values in the tree.
|
inline |
Returns true if the tree is empty. Shorthand for: