Claw 1.7.0
|
00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2011 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 contact: julien.jorge@gamned.org 00024 */ 00030 #ifndef __CLAW_AVL_HPP__ 00031 #define __CLAW_AVL_HPP__ 00032 00033 #include <claw/avl_base.hpp> 00034 00035 namespace claw 00036 { 00037 //--------------------------------------------------------------------------- 00042 template < class K, class Comp = std::less<K> > 00043 class avl 00044 { 00045 private: 00046 typedef avl_base<K, Comp> impl_type; 00047 00048 public: 00049 typedef K value_type; 00050 typedef K key_type; 00051 typedef K referent_type; 00052 typedef Comp key_less; 00053 typedef const K& const_reference; 00054 typedef typename impl_type::avl_const_iterator const_iterator; 00055 00056 public: 00057 avl(); 00058 explicit avl( const avl<K, Comp>& that ); 00059 template<typename InputIterator> 00060 avl( InputIterator first, InputIterator last ); 00061 00062 void insert( const K& key ); 00063 template<typename InputIterator> 00064 void insert( InputIterator first, InputIterator last ); 00065 00066 void erase( const K& key ); 00067 void clear(); 00068 00069 unsigned int size() const; 00070 bool empty() const; 00071 00072 const_iterator begin() const; 00073 const_iterator end() const; 00074 const_iterator find( const K& key ) const; 00075 const_iterator find_nearest_greater( const K& key ) const; 00076 const_iterator find_nearest_lower( const K& key ) const; 00077 const_iterator lower_bound() const; 00078 const_iterator upper_bound() const; 00079 00080 avl<K, Comp>& operator=( const avl<K, Comp>& that ); 00081 bool operator==( const avl<K, Comp>& that ) const; 00082 bool operator!=( const avl<K, Comp>& that ) const; 00083 bool operator<( const avl<K, Comp>& that ) const; 00084 bool operator>( const avl<K, Comp>& that ) const; 00085 bool operator<=( const avl<K, Comp>& that ) const; 00086 bool operator>=( const avl<K, Comp>& that ) const; 00087 00088 private: 00090 impl_type m_tree; 00091 00092 }; // class avl 00093 } // namespace claw 00094 00095 #include <claw/impl/avl.tpp> 00096 00097 #endif // __CLAW_AVL_HPP__