Claw
1.7.3
|
Binary search tree base AVL implementation. More...
#include <avl_base.hpp>
Classes | |
class | avl_const_iterator |
AVL iterator. More... | |
class | avl_iterator |
AVL iterator. More... | |
class | avl_node |
Node of a binary search tree (AVL). |
Public Types | |
typedef K | value_type |
typedef K | key_type |
typedef K | referent_type |
typedef Comp | key_less |
typedef const K & | const_reference |
typedef avl_iterator | iterator |
typedef avl_const_iterator | const_iterator |
Public Member Functions | |
avl_base () | |
AVL constructor. | |
avl_base (const avl_base< K, Comp > &that) | |
AVL copy constructor. | |
~avl_base () | |
AVL destructor. | |
void | insert (const K &key) |
Add a value in a tree. | |
template<typename Iterator > | |
void | insert (Iterator first, Iterator last) |
Add a range of items in the tree. | |
void | erase (const K &key) |
Delete a value in a tree. | |
void | clear () |
Clear a tree. | |
unsigned int | size () const |
Get the size of a tree. | |
bool | empty () const |
Tell if a tree is empty or not. | |
iterator | begin () |
Get an iterator on the nodes of the tree. | |
const_iterator | begin () const |
Get an iterator on the nodes of the tree. | |
iterator | end () |
Get an iterator after the end of the tree. | |
const_iterator | end () const |
Get an iterator after the end of the tree. | |
iterator | find (const K &key) |
Get an iterator on the nodes of the tree from a specified key. | |
const_iterator | find (const K &key) const |
Get an iterator on the nodes of the tree from a specified key. | |
iterator | find_nearest_greater (const K &key) |
Get an iterator on the nodes of the tree on the key imediatly after from a specified key. | |
const_iterator | find_nearest_greater (const K &key) const |
Get an iterator on the nodes of the tree on the key imediatly after from a specified key. | |
iterator | find_nearest_lower (const K &key) |
Get an iterator on the nodes of the tree on the key imediatly before from a specified key. | |
const_iterator | find_nearest_lower (const K &key) const |
Get an iterator on the nodes of the tree on the key imediatly before from a specified key. | |
iterator | lower_bound () |
Get an iterator on the lowest value of the tree. | |
const_iterator | lower_bound () const |
Get an iterator on the lowest value of the tree. | |
iterator | upper_bound () |
Get an iterator on the gratest value of the tree. | |
const_iterator | upper_bound () const |
Get an iterator on the gratest value of the tree. | |
avl_base< K, Comp > & | operator= (const avl_base< K, Comp > &that) |
Assignment operator. | |
bool | operator== (const avl_base< K, Comp > &that) const |
Equality. | |
bool | operator!= (const avl_base< K, Comp > &that) const |
Disequality. | |
bool | operator< (const avl_base< K, Comp > &that) const |
Less than operator. | |
bool | operator> (const avl_base< K, Comp > &that) const |
Greater than operator. | |
bool | operator<= (const avl_base< K, Comp > &that) const |
Less or equal operator. | |
bool | operator>= (const avl_base< K, Comp > &that) const |
Greater or equal operator. | |
void | swap (avl_base< K, Comp > &that) |
Swap the values with an other tree. |
Static Public Attributes | |
static key_less | s_key_less |
Function object used to compare keys. |
Binary search tree base AVL implementation.
Each key appears only once. Nodes are sorted as left_child < node < right_child.
Definition at line 57 of file avl_base.hpp.
claw::avl_base< K, Comp >::avl_base | ( | ) |
|
explicit |
AVL copy constructor.
that | AVL instance to copy from. |
Definition at line 903 of file avl_base.tpp.
void claw::avl_base< K, Comp >::clear | ( | ) |
|
inline |
Tell if a tree is empty or not.
Definition at line 1017 of file avl_base.tpp.
void claw::avl_base< K, Comp >::erase | ( | const K & | key | ) |
Delete a value in a tree.
key | Node key. |
Definition at line 972 of file avl_base.tpp.
claw::avl_base< K, Comp >::iterator claw::avl_base< K, Comp >::find | ( | const K & | key | ) |
Get an iterator on the nodes of the tree from a specified key.
key | Key to find. |
Definition at line 1083 of file avl_base.tpp.
claw::avl_base< K, Comp >::const_iterator claw::avl_base< K, Comp >::find | ( | const K & | key | ) | const |
Get an iterator on the nodes of the tree from a specified key.
key | Key to find. |
Definition at line 1095 of file avl_base.tpp.
claw::avl_base< K, Comp >::iterator claw::avl_base< K, Comp >::find_nearest_greater | ( | const K & | key | ) |
Get an iterator on the nodes of the tree on the key imediatly after from a specified key.
key | Key to find. |
Definition at line 1108 of file avl_base.tpp.
claw::avl_base< K, Comp >::const_iterator claw::avl_base< K, Comp >::find_nearest_greater | ( | const K & | key | ) | const |
Get an iterator on the nodes of the tree on the key imediatly after from a specified key.
key | Key to find. |
Definition at line 1121 of file avl_base.tpp.
claw::avl_base< K, Comp >::iterator claw::avl_base< K, Comp >::find_nearest_lower | ( | const K & | key | ) |
Get an iterator on the nodes of the tree on the key imediatly before from a specified key.
key | Key to find. |
Definition at line 1134 of file avl_base.tpp.
claw::avl_base< K, Comp >::const_iterator claw::avl_base< K, Comp >::find_nearest_lower | ( | const K & | key | ) | const |
Get an iterator on the nodes of the tree on the key imediatly before from a specified key.
key | Key to find. |
Definition at line 1147 of file avl_base.tpp.
void claw::avl_base< K, Comp >::insert | ( | const K & | key | ) |
Add a value in a tree.
key | Node key. |
Definition at line 934 of file avl_base.tpp.
void claw::avl_base< K, Comp >::insert | ( | Iterator | first, |
Iterator | last | ||
) |
Add a range of items in the tree.
first | Iterator on the first item to add. |
last | Iterator past the last item to add. |
Definition at line 959 of file avl_base.tpp.
bool claw::avl_base< K, Comp >::operator!= | ( | const avl_base< K, Comp > & | that | ) | const |
bool claw::avl_base< K, Comp >::operator< | ( | const avl_base< K, Comp > & | that | ) | const |
Less than operator.
that | AVL top compare to. |
Definition at line 1253 of file avl_base.tpp.
References claw::avl_base< K, Comp >::begin(), and claw::avl_base< K, Comp >::end().
bool claw::avl_base< K, Comp >::operator<= | ( | const avl_base< K, Comp > & | that | ) | const |
Less or equal operator.
that | AVL top compare to. |
Definition at line 1276 of file avl_base.tpp.
claw::avl_base< K, Comp > & claw::avl_base< K, Comp >::operator= | ( | const avl_base< K, Comp > & | that | ) |
Assignment operator.
that | AVL instance to copy from. |
Definition at line 1201 of file avl_base.tpp.
bool claw::avl_base< K, Comp >::operator== | ( | const avl_base< K, Comp > & | that | ) | const |
Equality.
that | AVL top compare to. |
Definition at line 1228 of file avl_base.tpp.
References claw::avl_base< K, Comp >::begin().
bool claw::avl_base< K, Comp >::operator> | ( | const avl_base< K, Comp > & | that | ) | const |
Greater than operator.
that | AVL top compare to. |
Definition at line 1265 of file avl_base.tpp.
bool claw::avl_base< K, Comp >::operator>= | ( | const avl_base< K, Comp > & | that | ) | const |
Greater or equal operator.
that | AVL top compare to. |
Definition at line 1287 of file avl_base.tpp.
|
inline |
void claw::avl_base< K, Comp >::swap | ( | avl_base< K, Comp > & | that | ) |
Swap the values with an other tree.
that | The other tree. |
Definition at line 1298 of file avl_base.tpp.