/home/ntakagi/work/STLport-5.1.5/stlport/stl/_hash_map.hGo to the documentation of this file.00001 /* 00002 * 00003 * Copyright (c) 1994 00004 * Hewlett-Packard Company 00005 * 00006 * Copyright (c) 1996,1997 00007 * Silicon Graphics Computer Systems, Inc. 00008 * 00009 * Copyright (c) 1997 00010 * Moscow Center for SPARC Technology 00011 * 00012 * Copyright (c) 1999 00013 * Boris Fomitchev 00014 * 00015 * This material is provided "as is", with absolutely no warranty expressed 00016 * or implied. Any use is at your own risk. 00017 * 00018 * Permission to use or copy this software for any purpose is hereby granted 00019 * without fee, provided the above notices are retained on all copies. 00020 * Permission to modify the code and to distribute modified code is granted, 00021 * provided the above notices are retained, and a notice that the code was 00022 * modified is included with the above copyright notice. 00023 * 00024 */ 00025 00026 /* NOTE: This is an internal header file, included by other STL headers. 00027 * You should not attempt to use it directly. 00028 */ 00029 00030 #ifndef _STLP_INTERNAL_HASH_MAP_H 00031 #define _STLP_INTERNAL_HASH_MAP_H 00032 00033 #ifndef _STLP_INTERNAL_HASHTABLE_H 00034 # include <stl/_hashtable.h> 00035 #endif 00036 00037 _STLP_BEGIN_NAMESPACE 00038 00039 //Specific iterator traits creation 00040 _STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits) 00041 00042 template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>), 00043 _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), 00044 _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > 00045 class hash_map 00046 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) 00047 : public __stlport_class<hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> > 00048 #endif 00049 { 00050 private: 00051 typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; 00052 public: 00053 typedef _Key key_type; 00054 typedef _Tp data_type; 00055 typedef _Tp mapped_type; 00056 #if !defined (__DMC__) 00057 typedef pair<const key_type, data_type> value_type; 00058 #else 00059 /* DMC goes too far in template instanciation and tries to fully instanciate 00060 * slist<pair<const int, string> > for instance. The generation of assignment 00061 * operator fails of course so we are force to use mutable key for this compiler. 00062 */ 00063 typedef pair<key_type, data_type> value_type; 00064 #endif 00065 private: 00066 //Specific iterator traits creation 00067 typedef _STLP_PRIV _HashMapTraitsT<value_type> _HashMapTraits; 00068 00069 public: 00070 typedef hashtable<value_type, key_type, _HashFcn, _HashMapTraits, 00071 _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht; 00072 00073 typedef typename _Ht::hasher hasher; 00074 typedef typename _Ht::key_equal key_equal; 00075 00076 typedef typename _Ht::size_type size_type; 00077 typedef typename _Ht::difference_type difference_type; 00078 typedef typename _Ht::pointer pointer; 00079 typedef typename _Ht::const_pointer const_pointer; 00080 typedef typename _Ht::reference reference; 00081 typedef typename _Ht::const_reference const_reference; 00082 00083 typedef typename _Ht::iterator iterator; 00084 typedef typename _Ht::const_iterator const_iterator; 00085 00086 typedef typename _Ht::allocator_type allocator_type; 00087 00088 hasher hash_funct() const { return _M_ht.hash_funct(); } 00089 key_equal key_eq() const { return _M_ht.key_eq(); } 00090 allocator_type get_allocator() const { return _M_ht.get_allocator(); } 00091 00092 private: 00093 _Ht _M_ht; 00094 _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) 00095 public: 00096 hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} 00097 explicit hash_map(size_type __n) 00098 : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} 00099 hash_map(size_type __n, const hasher& __hf) 00100 : _M_ht(__n, __hf, key_equal(), allocator_type()) {} 00101 hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, 00102 const allocator_type& __a = allocator_type()) 00103 : _M_ht(__n, __hf, __eql, __a) {} 00104 00105 hash_map(__move_source<_Self> src) 00106 : _M_ht(__move_source<_Ht>(src.get()._M_ht)) { 00107 } 00108 00109 #ifdef _STLP_MEMBER_TEMPLATES 00110 template <class _InputIterator> 00111 hash_map(_InputIterator __f, _InputIterator __l) 00112 : _M_ht(100, hasher(), key_equal(), allocator_type()) 00113 { _M_ht.insert_unique(__f, __l); } 00114 template <class _InputIterator> 00115 hash_map(_InputIterator __f, _InputIterator __l, size_type __n) 00116 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 00117 { _M_ht.insert_unique(__f, __l); } 00118 template <class _InputIterator> 00119 hash_map(_InputIterator __f, _InputIterator __l, size_type __n, 00120 const hasher& __hf) 00121 : _M_ht(__n, __hf, key_equal(), allocator_type()) 00122 { _M_ht.insert_unique(__f, __l); } 00123 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 00124 template <class _InputIterator> 00125 hash_map(_InputIterator __f, _InputIterator __l, size_type __n, 00126 const hasher& __hf, const key_equal& __eql) 00127 : _M_ht(__n, __hf, __eql, allocator_type()) 00128 { _M_ht.insert_unique(__f, __l); } 00129 # endif 00130 template <class _InputIterator> 00131 hash_map(_InputIterator __f, _InputIterator __l, size_type __n, 00132 const hasher& __hf, const key_equal& __eql, 00133 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) 00134 : _M_ht(__n, __hf, __eql, __a) 00135 { _M_ht.insert_unique(__f, __l); } 00136 00137 #else 00138 hash_map(const value_type* __f, const value_type* __l) 00139 : _M_ht(100, hasher(), key_equal(), allocator_type()) 00140 { _M_ht.insert_unique(__f, __l); } 00141 hash_map(const value_type* __f, const value_type* __l, size_type __n) 00142 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 00143 { _M_ht.insert_unique(__f, __l); } 00144 hash_map(const value_type* __f, const value_type* __l, size_type __n, 00145 const hasher& __hf) 00146 : _M_ht(__n, __hf, key_equal(), allocator_type()) 00147 { _M_ht.insert_unique(__f, __l); } 00148 hash_map(const value_type* __f, const value_type* __l, size_type __n, 00149 const hasher& __hf, const key_equal& __eql, 00150 const allocator_type& __a = allocator_type()) 00151 : _M_ht(__n, __hf, __eql, __a) 00152 { _M_ht.insert_unique(__f, __l); } 00153 00154 hash_map(const_iterator __f, const_iterator __l) 00155 : _M_ht(100, hasher(), key_equal(), allocator_type()) 00156 { _M_ht.insert_unique(__f, __l); } 00157 hash_map(const_iterator __f, const_iterator __l, size_type __n) 00158 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 00159 { _M_ht.insert_unique(__f, __l); } 00160 hash_map(const_iterator __f, const_iterator __l, size_type __n, 00161 const hasher& __hf) 00162 : _M_ht(__n, __hf, key_equal(), allocator_type()) 00163 { _M_ht.insert_unique(__f, __l); } 00164 hash_map(const_iterator __f, const_iterator __l, size_type __n, 00165 const hasher& __hf, const key_equal& __eql, 00166 const allocator_type& __a = allocator_type()) 00167 : _M_ht(__n, __hf, __eql, __a) 00168 { _M_ht.insert_unique(__f, __l); } 00169 #endif /*_STLP_MEMBER_TEMPLATES */ 00170 00171 public: 00172 size_type size() const { return _M_ht.size(); } 00173 size_type max_size() const { return _M_ht.max_size(); } 00174 bool empty() const { return _M_ht.empty(); } 00175 void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } 00176 iterator begin() { return _M_ht.begin(); } 00177 iterator end() { return _M_ht.end(); } 00178 const_iterator begin() const { return _M_ht.begin(); } 00179 const_iterator end() const { return _M_ht.end(); } 00180 00181 public: 00182 pair<iterator,bool> insert(const value_type& __obj) 00183 { return _M_ht.insert_unique(__obj); } 00184 #ifdef _STLP_MEMBER_TEMPLATES 00185 template <class _InputIterator> 00186 void insert(_InputIterator __f, _InputIterator __l) 00187 { _M_ht.insert_unique(__f,__l); } 00188 #else 00189 void insert(const value_type* __f, const value_type* __l) 00190 { _M_ht.insert_unique(__f,__l); } 00191 void insert(const_iterator __f, const_iterator __l) 00192 { _M_ht.insert_unique(__f, __l); } 00193 #endif /*_STLP_MEMBER_TEMPLATES */ 00194 pair<iterator,bool> insert_noresize(const value_type& __obj) 00195 { return _M_ht.insert_unique_noresize(__obj); } 00196 00197 _STLP_TEMPLATE_FOR_CONT_EXT 00198 iterator find(const _KT& __key) { return _M_ht.find(__key); } 00199 _STLP_TEMPLATE_FOR_CONT_EXT 00200 const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } 00201 00202 _STLP_TEMPLATE_FOR_CONT_EXT 00203 _Tp& operator[](const _KT& __key) { 00204 iterator __it = _M_ht.find(__key); 00205 return (__it == _M_ht.end() ? 00206 _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second : 00207 (*__it).second ); 00208 } 00209 00210 _STLP_TEMPLATE_FOR_CONT_EXT 00211 size_type count(const _KT& __key) const { return _M_ht.count(__key); } 00212 00213 _STLP_TEMPLATE_FOR_CONT_EXT 00214 pair<iterator, iterator> equal_range(const _KT& __key) 00215 { return _M_ht.equal_range(__key); } 00216 _STLP_TEMPLATE_FOR_CONT_EXT 00217 pair<const_iterator, const_iterator> equal_range(const _KT& __key) const 00218 { return _M_ht.equal_range(__key); } 00219 00220 _STLP_TEMPLATE_FOR_CONT_EXT 00221 size_type erase(const _KT& __key) {return _M_ht.erase(__key); } 00222 void erase(iterator __it) { _M_ht.erase(__it); } 00223 void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } 00224 void clear() { _M_ht.clear(); } 00225 00226 void resize(size_type __hint) { _M_ht.resize(__hint); } 00227 size_type bucket_count() const { return _M_ht.bucket_count(); } 00228 size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } 00229 size_type elems_in_bucket(size_type __n) const 00230 { return _M_ht.elems_in_bucket(__n); } 00231 }; 00232 00233 //Specific iterator traits creation 00234 _STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits) 00235 00236 template <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>), 00237 _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), 00238 _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) > 00239 class hash_multimap 00240 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) 00241 : public __stlport_class<hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> > 00242 #endif 00243 { 00244 private: 00245 typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; 00246 public: 00247 typedef _Key key_type; 00248 typedef _Tp data_type; 00249 typedef _Tp mapped_type; 00250 #if !defined (__DMC__) 00251 typedef pair<const key_type, data_type> value_type; 00252 #else 00253 typedef pair<key_type, data_type> value_type; 00254 #endif 00255 private: 00256 //Specific iterator traits creation 00257 typedef _STLP_PRIV _HashMultimapTraitsT<value_type> _HashMultimapTraits; 00258 00259 public: 00260 typedef hashtable<value_type, key_type, _HashFcn, _HashMultimapTraits, 00261 _STLP_SELECT1ST(value_type, _Key), _EqualKey, _Alloc > _Ht; 00262 00263 typedef typename _Ht::hasher hasher; 00264 typedef typename _Ht::key_equal key_equal; 00265 00266 typedef typename _Ht::size_type size_type; 00267 typedef typename _Ht::difference_type difference_type; 00268 typedef typename _Ht::pointer pointer; 00269 typedef typename _Ht::const_pointer const_pointer; 00270 typedef typename _Ht::reference reference; 00271 typedef typename _Ht::const_reference const_reference; 00272 00273 typedef typename _Ht::iterator iterator; 00274 typedef typename _Ht::const_iterator const_iterator; 00275 00276 typedef typename _Ht::allocator_type allocator_type; 00277 00278 hasher hash_funct() const { return _M_ht.hash_funct(); } 00279 key_equal key_eq() const { return _M_ht.key_eq(); } 00280 allocator_type get_allocator() const { return _M_ht.get_allocator(); } 00281 00282 private: 00283 _Ht _M_ht; 00284 _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) 00285 public: 00286 hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} 00287 explicit hash_multimap(size_type __n) 00288 : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} 00289 hash_multimap(size_type __n, const hasher& __hf) 00290 : _M_ht(__n, __hf, key_equal(), allocator_type()) {} 00291 hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, 00292 const allocator_type& __a = allocator_type()) 00293 : _M_ht(__n, __hf, __eql, __a) {} 00294 00295 hash_multimap(__move_source<_Self> src) 00296 : _M_ht(__move_source<_Ht>(src.get()._M_ht)) { 00297 } 00298 00299 #ifdef _STLP_MEMBER_TEMPLATES 00300 template <class _InputIterator> 00301 hash_multimap(_InputIterator __f, _InputIterator __l) 00302 : _M_ht(100, hasher(), key_equal(), allocator_type()) 00303 { _M_ht.insert_equal(__f, __l); } 00304 template <class _InputIterator> 00305 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) 00306 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 00307 { _M_ht.insert_equal(__f, __l); } 00308 template <class _InputIterator> 00309 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, 00310 const hasher& __hf) 00311 : _M_ht(__n, __hf, key_equal(), allocator_type()) 00312 { _M_ht.insert_equal(__f, __l); } 00313 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 00314 template <class _InputIterator> 00315 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, 00316 const hasher& __hf, const key_equal& __eql) 00317 : _M_ht(__n, __hf, __eql, allocator_type()) 00318 { _M_ht.insert_equal(__f, __l); } 00319 # endif 00320 template <class _InputIterator> 00321 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, 00322 const hasher& __hf, const key_equal& __eql, 00323 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) 00324 : _M_ht(__n, __hf, __eql, __a) 00325 { _M_ht.insert_equal(__f, __l); } 00326 00327 #else 00328 hash_multimap(const value_type* __f, const value_type* __l) 00329 : _M_ht(100, hasher(), key_equal(), allocator_type()) 00330 { _M_ht.insert_equal(__f, __l); } 00331 hash_multimap(const value_type* __f, const value_type* __l, size_type __n) 00332 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 00333 { _M_ht.insert_equal(__f, __l); } 00334 hash_multimap(const value_type* __f, const value_type* __l, size_type __n, 00335 const hasher& __hf) 00336 : _M_ht(__n, __hf, key_equal(), allocator_type()) 00337 { _M_ht.insert_equal(__f, __l); } 00338 hash_multimap(const value_type* __f, const value_type* __l, size_type __n, 00339 const hasher& __hf, const key_equal& __eql, 00340 const allocator_type& __a = allocator_type()) 00341 : _M_ht(__n, __hf, __eql, __a) 00342 { _M_ht.insert_equal(__f, __l); } 00343 00344 hash_multimap(const_iterator __f, const_iterator __l) 00345 : _M_ht(100, hasher(), key_equal(), allocator_type()) 00346 { _M_ht.insert_equal(__f, __l); } 00347 hash_multimap(const_iterator __f, const_iterator __l, size_type __n) 00348 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 00349 { _M_ht.insert_equal(__f, __l); } 00350 hash_multimap(const_iterator __f, const_iterator __l, size_type __n, 00351 const hasher& __hf) 00352 : _M_ht(__n, __hf, key_equal(), allocator_type()) 00353 { _M_ht.insert_equal(__f, __l); } 00354 hash_multimap(const_iterator __f, const_iterator __l, size_type __n, 00355 const hasher& __hf, const key_equal& __eql, 00356 const allocator_type& __a = allocator_type()) 00357 : _M_ht(__n, __hf, __eql, __a) 00358 { _M_ht.insert_equal(__f, __l); } 00359 #endif /*_STLP_MEMBER_TEMPLATES */ 00360 00361 public: 00362 size_type size() const { return _M_ht.size(); } 00363 size_type max_size() const { return _M_ht.max_size(); } 00364 bool empty() const { return _M_ht.empty(); } 00365 void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } 00366 00367 iterator begin() { return _M_ht.begin(); } 00368 iterator end() { return _M_ht.end(); } 00369 const_iterator begin() const { return _M_ht.begin(); } 00370 const_iterator end() const { return _M_ht.end(); } 00371 00372 public: 00373 iterator insert(const value_type& __obj) 00374 { return _M_ht.insert_equal(__obj); } 00375 #ifdef _STLP_MEMBER_TEMPLATES 00376 template <class _InputIterator> 00377 void insert(_InputIterator __f, _InputIterator __l) 00378 { _M_ht.insert_equal(__f,__l); } 00379 #else 00380 void insert(const value_type* __f, const value_type* __l) { 00381 _M_ht.insert_equal(__f,__l); 00382 } 00383 void insert(const_iterator __f, const_iterator __l) 00384 { _M_ht.insert_equal(__f, __l); } 00385 #endif /*_STLP_MEMBER_TEMPLATES */ 00386 iterator insert_noresize(const value_type& __obj) 00387 { return _M_ht.insert_equal_noresize(__obj); } 00388 00389 _STLP_TEMPLATE_FOR_CONT_EXT 00390 iterator find(const _KT& __key) { return _M_ht.find(__key); } 00391 _STLP_TEMPLATE_FOR_CONT_EXT 00392 const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } 00393 00394 _STLP_TEMPLATE_FOR_CONT_EXT 00395 size_type count(const _KT& __key) const { return _M_ht.count(__key); } 00396 00397 _STLP_TEMPLATE_FOR_CONT_EXT 00398 pair<iterator, iterator> 00399 equal_range(const _KT& __key) { return _M_ht.equal_range(__key); } 00400 _STLP_TEMPLATE_FOR_CONT_EXT 00401 pair<const_iterator, const_iterator> 00402 equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); } 00403 00404 _STLP_TEMPLATE_FOR_CONT_EXT 00405 size_type erase(const _KT& __key) {return _M_ht.erase(__key); } 00406 void erase(iterator __it) { _M_ht.erase(__it); } 00407 void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } 00408 void clear() { _M_ht.clear(); } 00409 00410 public: 00411 void resize(size_type __hint) { _M_ht.resize(__hint); } 00412 size_type bucket_count() const { return _M_ht.bucket_count(); } 00413 size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } 00414 size_type elems_in_bucket(size_type __n) const 00415 { return _M_ht.elems_in_bucket(__n); } 00416 }; 00417 00418 #define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> 00419 #define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> 00420 #include <stl/_relops_hash_cont.h> 00421 #undef _STLP_TEMPLATE_CONTAINER 00422 #define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> 00423 #include <stl/_relops_hash_cont.h> 00424 #undef _STLP_TEMPLATE_CONTAINER 00425 #undef _STLP_TEMPLATE_HEADER 00426 00427 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) 00428 template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> 00429 struct __move_traits<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > : 00430 _STLP_PRIV __move_traits_help<typename hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht> 00431 {}; 00432 00433 template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> 00434 struct __move_traits<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > : 00435 _STLP_PRIV __move_traits_help<typename hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht> 00436 {}; 00437 00438 // Specialization of insert_iterator so that it will work for hash_map 00439 // and hash_multimap. 00440 template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> 00441 class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { 00442 protected: 00443 typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; 00444 _Container* container; 00445 public: 00446 typedef _Container container_type; 00447 typedef output_iterator_tag iterator_category; 00448 typedef void value_type; 00449 typedef void difference_type; 00450 typedef void pointer; 00451 typedef void reference; 00452 00453 insert_iterator(_Container& __x) : container(&__x) {} 00454 insert_iterator(_Container& __x, typename _Container::iterator) 00455 : container(&__x) {} 00456 insert_iterator<_Container>& 00457 operator=(const typename _Container::value_type& __val) { 00458 container->insert(__val); 00459 return *this; 00460 } 00461 insert_iterator<_Container>& operator*() { return *this; } 00462 insert_iterator<_Container>& operator++() { return *this; } 00463 insert_iterator<_Container>& operator++(int) { return *this; } 00464 }; 00465 00466 template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> 00467 class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { 00468 protected: 00469 typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; 00470 _Container* container; 00471 typename _Container::iterator iter; 00472 public: 00473 typedef _Container container_type; 00474 typedef output_iterator_tag iterator_category; 00475 typedef void value_type; 00476 typedef void difference_type; 00477 typedef void pointer; 00478 typedef void reference; 00479 00480 insert_iterator(_Container& __x) : container(&__x) {} 00481 insert_iterator(_Container& __x, typename _Container::iterator) 00482 : container(&__x) {} 00483 insert_iterator<_Container>& 00484 operator=(const typename _Container::value_type& __val) { 00485 container->insert(__val); 00486 return *this; 00487 } 00488 insert_iterator<_Container>& operator*() { return *this; } 00489 insert_iterator<_Container>& operator++() { return *this; } 00490 insert_iterator<_Container>& operator++(int) { return *this; } 00491 }; 00492 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ 00493 00494 _STLP_END_NAMESPACE 00495 00496 #endif /* _STLP_INTERNAL_HASH_MAP_H */ 00497 00498 // Local Variables: 00499 // mode:C++ 00500 // End:
Generated on Mon Mar 10 15:32:23 2008 by ![]() |