Claw  1.7.3
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
claw::avl_base< K, Comp > Class Template Reference

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...
 

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 (const avl_base< K, Comp > &that)
 
void insert (const K &key)
 
template<typename Iterator >
void insert (Iterator first, Iterator last)
 
void erase (const K &key)
 
void clear ()
 
unsigned int size () const
 
bool empty () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator find (const K &key)
 
const_iterator find (const K &key) const
 
iterator find_nearest_greater (const K &key)
 
const_iterator find_nearest_greater (const K &key) const
 
iterator find_nearest_lower (const K &key)
 
const_iterator find_nearest_lower (const K &key) const
 
iterator lower_bound ()
 
const_iterator lower_bound () const
 
iterator upper_bound ()
 
const_iterator upper_bound () const
 
avl_base< K, Comp > & operator= (const avl_base< K, Comp > &that)
 
bool operator== (const avl_base< K, Comp > &that) const
 
bool operator!= (const avl_base< K, Comp > &that) const
 
bool operator< (const avl_base< K, Comp > &that) const
 
bool operator> (const avl_base< K, Comp > &that) const
 
bool operator<= (const avl_base< K, Comp > &that) const
 
bool operator>= (const avl_base< K, Comp > &that) const
 
void swap (avl_base< K, Comp > &that)
 

Static Public Attributes

static key_less s_key_less
 Function object used to compare keys.
 

Detailed Description

template<class K, class Comp = std::less<K>>
class claw::avl_base< K, Comp >

Binary search tree base AVL implementation.

Each key appears only once. Nodes are sorted as left_child < node < right_child.

Invariant
this->empty() <==> (this->size() == 0)
this is an AVL.
Remarks
Type requirements :
  • K is LessThanComparable ;
  • Comp is a binary predicate such that Comp(K a, K b) == true if a < b.
Code is taken from a C implementation, so perhaps it doesn't really look nice for C++. Nevertheless it works perfectly and it's fast conversion : that good things.
Author
Julien Jorge

Definition at line 57 of file avl_base.hpp.


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