Claw
1.7.3
|
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 #include <cassert> 00031 00032 /*----------------------------------------------------------------------------*/ 00037 template<class K, class Comp> 00038 claw::avl<K,Comp>::avl() 00039 { 00040 00041 } // avl::avl() [constructor] 00042 00043 /*----------------------------------------------------------------------------*/ 00048 template<class K, class Comp> 00049 claw::avl<K,Comp>::avl( const avl<K, Comp>& that ) 00050 : m_tree(that.m_tree) 00051 { 00052 00053 } // avl::avl() [copy constructor] 00054 00055 /*----------------------------------------------------------------------------*/ 00061 template<class K, class Comp> 00062 template<typename InputIterator> 00063 claw::avl<K,Comp>::avl( InputIterator first, InputIterator last ) 00064 { 00065 m_tree.insert(first, last); 00066 } // avl::avl() [constructor from range] 00067 00068 /*----------------------------------------------------------------------------*/ 00074 template<class K, class Comp> 00075 void claw::avl<K,Comp>::insert( const K& key ) 00076 { 00077 m_tree.insert(key); 00078 } // avl::insert() 00079 00080 /*----------------------------------------------------------------------------*/ 00088 template<class K, class Comp> 00089 template<typename InputIterator> 00090 void claw::avl<K,Comp>::insert( InputIterator first, InputIterator last ) 00091 { 00092 m_tree.insert(first, last); 00093 } // avl::insert() 00094 00095 /*----------------------------------------------------------------------------*/ 00101 template<class K, class Comp> 00102 void claw::avl<K,Comp>::erase( const K& key ) 00103 { 00104 m_tree.erase(key); 00105 } // avl::erase() 00106 00107 /*----------------------------------------------------------------------------*/ 00112 template<class K, class Comp> 00113 void claw::avl<K,Comp>::clear() 00114 { 00115 m_tree.clear(); 00116 } // avl::clear() 00117 00118 /*----------------------------------------------------------------------------*/ 00123 template<class K, class Comp> 00124 inline unsigned int claw::avl<K,Comp>::size() const 00125 { 00126 return m_tree.size(); 00127 } // avl::size() 00128 00129 /*----------------------------------------------------------------------------*/ 00134 template<class K, class Comp> 00135 inline bool claw::avl<K,Comp>::empty() const 00136 { 00137 return m_tree.empty(); 00138 } // avl::empty() 00139 00140 /*----------------------------------------------------------------------------*/ 00144 template<class K, class Comp> 00145 typename claw::avl<K,Comp>::const_iterator 00146 claw::avl<K,Comp>::begin() const 00147 { 00148 return m_tree.begin(); 00149 } // avl::begin() 00150 00151 /*----------------------------------------------------------------------------*/ 00155 template<class K, class Comp> 00156 typename claw::avl<K,Comp>::const_iterator claw::avl<K,Comp>::end() const 00157 { 00158 return m_tree.end(); 00159 } // avl::end() 00160 00161 /*----------------------------------------------------------------------------*/ 00166 template<class K, class Comp> 00167 typename claw::avl<K,Comp>::const_iterator 00168 claw::avl<K,Comp>::find( const K& key ) const 00169 { 00170 return m_tree.find(key); 00171 } // avl::find() 00172 00173 /*----------------------------------------------------------------------------*/ 00179 template<class K, class Comp> 00180 typename claw::avl<K,Comp>::const_iterator 00181 claw::avl<K,Comp>::find_nearest_greater( const K& key ) const 00182 { 00183 return m_tree.find_nearest_greater(key); 00184 } // avl::find_nearest_greater() 00185 00186 /*----------------------------------------------------------------------------*/ 00192 template<class K, class Comp> 00193 typename claw::avl<K,Comp>::const_iterator 00194 claw::avl<K,Comp>::find_nearest_lower( const K& key ) const 00195 { 00196 return m_tree.find_nearest_lower(key); 00197 } // avl::find_nearest_lower() 00198 00199 /*----------------------------------------------------------------------------*/ 00203 template<class K, class Comp> 00204 typename claw::avl<K,Comp>::const_iterator 00205 claw::avl<K,Comp>::lower_bound() const 00206 { 00207 return m_tree.lower_bound(); 00208 } // avl::lower_bound() 00209 00210 /*----------------------------------------------------------------------------*/ 00214 template<class K, class Comp> 00215 typename claw::avl<K,Comp>::const_iterator 00216 claw::avl<K,Comp>::upper_bound() const 00217 { 00218 return m_tree.upper_bound(); 00219 } // avl::upper_bound() 00220 00221 /*----------------------------------------------------------------------------*/ 00226 template<class K, class Comp> 00227 claw::avl<K, Comp>& claw::avl<K,Comp>::operator=( const avl<K, Comp>& that ) 00228 { 00229 m_tree = that.m_tree; 00230 return *this; 00231 } // avl::operator=() 00232 00233 /*----------------------------------------------------------------------------*/ 00238 template<class K, class Comp> 00239 bool claw::avl<K,Comp>::operator==( const avl<K, Comp>& that ) const 00240 { 00241 return m_tree == that.m_tree; 00242 } // avl::operator==() 00243 00244 /*----------------------------------------------------------------------------*/ 00249 template<class K, class Comp> 00250 bool claw::avl<K,Comp>::operator!=( const avl<K, Comp>& that ) const 00251 { 00252 return m_tree != that.m_tree; 00253 } // avl::operator!=() 00254 00255 /*----------------------------------------------------------------------------*/ 00260 template<class K, class Comp> 00261 bool claw::avl<K,Comp>::operator<( const avl<K, Comp>& that ) const 00262 { 00263 return m_tree < that.m_tree; 00264 } // avl::operator<() 00265 00266 /*----------------------------------------------------------------------------*/ 00271 template<class K, class Comp> 00272 bool claw::avl<K,Comp>::operator>( const avl<K, Comp>& that ) const 00273 { 00274 return m_tree > that.m_tree; 00275 } // avl::operator>() 00276 00277 /*----------------------------------------------------------------------------*/ 00282 template<class K, class Comp> 00283 bool claw::avl<K,Comp>::operator<=( const avl<K, Comp>& that ) const 00284 { 00285 return m_tree <= that.m_tree; 00286 } // avl::operator<=() 00287 00288 /*----------------------------------------------------------------------------*/ 00293 template<class K, class Comp> 00294 bool claw::avl<K,Comp>::operator>=( const avl<K, Comp>& that ) const 00295 { 00296 return m_tree >= that.m_tree; 00297 } // avl::operator>=()