1 /* 2 * 3 * Copyright (c) 1994 4 * Hewlett-Packard Company 5 * 6 * Copyright (c) 1996,1997 7 * Silicon Graphics Computer Systems, Inc. 8 * 9 * Copyright (c) 1997 10 * Moscow Center for SPARC Technology 11 * 12 * Copyright (c) 1999 13 * Boris Fomitchev 14 * 15 * This material is provided "as is", with absolutely no warranty expressed 16 * or implied. Any use is at your own risk. 17 * 18 * Permission to use or copy this software for any purpose is hereby granted 19 * without fee, provided the above notices are retained on all copies. 20 * Permission to modify the code and to distribute modified code is granted, 21 * provided the above notices are retained, and a notice that the code was 22 * modified is included with the above copyright notice. 23 * 24 */ 25 26 /* NOTE: File was modified to fix include paths 27 */ 28 29 /* NOTE: This is an internal header file, included by other STL headers. 30 * You should not attempt to use it directly. 31 */ 32 33 #ifndef _STLP_INTERNAL_HASH_SET_H 34 #define _STLP_INTERNAL_HASH_SET_H 35 36 #ifndef _STLP_INTERNAL_HASHTABLE_H 37 # include <stl/_hashtable.h> 38 #endif 39 40 # define hash_set __WORKAROUND_RENAME(hash_set) 41 # define hash_multiset __WORKAROUND_RENAME(hash_multiset) 42 43 _STLP_BEGIN_NAMESPACE 44 45 template <class _Value, __DFL_TMPL_PARAM(_HashFcn,hash<_Value>), 46 __DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>), 47 _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) > 48 class hash_set 49 { 50 private: 51 typedef hashtable<_Value, _Value, _HashFcn, _STLP_Identity<_Value>, 52 _EqualKey, _Alloc> _Ht; 53 typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self; 54 typedef typename _Ht::iterator _ht_iterator; 55 public: 56 typedef typename _Ht::key_type key_type; 57 typedef typename _Ht::value_type value_type; 58 typedef typename _Ht::hasher hasher; 59 typedef typename _Ht::key_equal key_equal; 60 61 typedef typename _Ht::size_type size_type; 62 typedef typename _Ht::difference_type difference_type; 63 typedef typename _Ht::pointer pointer; 64 typedef typename _Ht::const_pointer const_pointer; 65 typedef typename _Ht::reference reference; 66 typedef typename _Ht::const_reference const_reference; 67 68 // SunPro bug 69 typedef typename _Ht::const_iterator const_iterator; 70 typedef const_iterator iterator; 71 72 typedef typename _Ht::allocator_type allocator_type; 73 hash_funct()74 hasher hash_funct() const { return _M_ht.hash_funct(); } key_eq()75 key_equal key_eq() const { return _M_ht.key_eq(); } get_allocator()76 allocator_type get_allocator() const { return _M_ht.get_allocator(); } 77 78 private: 79 _Ht _M_ht; 80 81 public: 82 /// @deprecated Use std::unordered_set hash_set()83 NCBI_DEPRECATED hash_set() 84 : _M_ht(100, hasher(), key_equal(), allocator_type()) {} 85 /// @deprecated Use std::unordered_set hash_set(size_type __n)86 NCBI_DEPRECATED explicit hash_set(size_type __n) 87 : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} 88 /// @deprecated Use std::unordered_set hash_set(size_type __n,const hasher & __hf)89 NCBI_DEPRECATED hash_set(size_type __n, const hasher& __hf) 90 : _M_ht(__n, __hf, key_equal(), allocator_type()) {} 91 /// @deprecated Use std::unordered_set 92 NCBI_DEPRECATED hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, 93 const allocator_type& __a = allocator_type()) _M_ht(__n,__hf,__eql,__a)94 : _M_ht(__n, __hf, __eql, __a) {} 95 96 #ifdef _STLP_MEMBER_TEMPLATES 97 template <class _InputIterator> 98 /// @deprecated Use std::unordered_set hash_set(_InputIterator __f,_InputIterator __l)99 NCBI_DEPRECATED hash_set(_InputIterator __f, _InputIterator __l) 100 : _M_ht(100, hasher(), key_equal(), allocator_type()) 101 { _M_ht.insert_unique(__f, __l); } 102 template <class _InputIterator> 103 /// @deprecated Use std::unordered_set hash_set(_InputIterator __f,_InputIterator __l,size_type __n)104 NCBI_DEPRECATED hash_set(_InputIterator __f, _InputIterator __l, size_type __n) 105 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 106 { _M_ht.insert_unique(__f, __l); } 107 template <class _InputIterator> 108 /// @deprecated Use std::unordered_set hash_set(_InputIterator __f,_InputIterator __l,size_type __n,const hasher & __hf)109 NCBI_DEPRECATED hash_set(_InputIterator __f, _InputIterator __l, size_type __n, 110 const hasher& __hf) 111 : _M_ht(__n, __hf, key_equal(), allocator_type()) 112 { _M_ht.insert_unique(__f, __l); } 113 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 114 template <class _InputIterator> 115 /// @deprecated Use std::unordered_set hash_set(_InputIterator __f,_InputIterator __l,size_type __n,const hasher & __hf,const key_equal & __eql)116 NCBI_DEPRECATED hash_set(_InputIterator __f, _InputIterator __l, size_type __n, 117 const hasher& __hf, const key_equal& __eql) 118 : _M_ht(__n, __hf, __eql, allocator_type()) 119 { _M_ht.insert_unique(__f, __l); } 120 # endif 121 template <class _InputIterator> 122 /// @deprecated Use std::unordered_set hash_set(_InputIterator __f,_InputIterator __l,size_type __n,const hasher & __hf,const key_equal & __eql,const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)123 NCBI_DEPRECATED hash_set(_InputIterator __f, _InputIterator __l, size_type __n, 124 const hasher& __hf, const key_equal& __eql, 125 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) 126 : _M_ht(__n, __hf, __eql, __a) 127 { _M_ht.insert_unique(__f, __l); } 128 #else 129 130 /// @deprecated Use std::unordered_set hash_set(const value_type * __f,const value_type * __l)131 NCBI_DEPRECATED hash_set(const value_type* __f, const value_type* __l) 132 : _M_ht(100, hasher(), key_equal(), allocator_type()) 133 { _M_ht.insert_unique(__f, __l); } 134 /// @deprecated Use std::unordered_set hash_set(const value_type * __f,const value_type * __l,size_type __n)135 NCBI_DEPRECATED hash_set(const value_type* __f, const value_type* __l, size_type __n) 136 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 137 { _M_ht.insert_unique(__f, __l); } 138 /// @deprecated Use std::unordered_set hash_set(const value_type * __f,const value_type * __l,size_type __n,const hasher & __hf)139 NCBI_DEPRECATED hash_set(const value_type* __f, const value_type* __l, size_type __n, 140 const hasher& __hf) 141 : _M_ht(__n, __hf, key_equal(), allocator_type()) 142 { _M_ht.insert_unique(__f, __l); } 143 /// @deprecated Use std::unordered_set 144 NCBI_DEPRECATED hash_set(const value_type* __f, const value_type* __l, size_type __n, 145 const hasher& __hf, const key_equal& __eql, 146 const allocator_type& __a = allocator_type()) _M_ht(__n,__hf,__eql,__a)147 : _M_ht(__n, __hf, __eql, __a) 148 { _M_ht.insert_unique(__f, __l); } 149 150 /// @deprecated Use std::unordered_set hash_set(const_iterator __f,const_iterator __l)151 NCBI_DEPRECATED hash_set(const_iterator __f, const_iterator __l) 152 : _M_ht(100, hasher(), key_equal(), allocator_type()) 153 { _M_ht.insert_unique(__f, __l); } 154 /// @deprecated Use std::unordered_set hash_set(const_iterator __f,const_iterator __l,size_type __n)155 NCBI_DEPRECATED hash_set(const_iterator __f, const_iterator __l, size_type __n) 156 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 157 { _M_ht.insert_unique(__f, __l); } 158 /// @deprecated Use std::unordered_set hash_set(const_iterator __f,const_iterator __l,size_type __n,const hasher & __hf)159 NCBI_DEPRECATED hash_set(const_iterator __f, const_iterator __l, size_type __n, 160 const hasher& __hf) 161 : _M_ht(__n, __hf, key_equal(), allocator_type()) 162 { _M_ht.insert_unique(__f, __l); } 163 /// @deprecated Use std::unordered_set 164 NCBI_DEPRECATED hash_set(const_iterator __f, const_iterator __l, size_type __n, 165 const hasher& __hf, const key_equal& __eql, 166 const allocator_type& __a = allocator_type()) _M_ht(__n,__hf,__eql,__a)167 : _M_ht(__n, __hf, __eql, __a) 168 { _M_ht.insert_unique(__f, __l); } 169 #endif /*_STLP_MEMBER_TEMPLATES */ 170 171 public: size()172 size_type size() const { return _M_ht.size(); } max_size()173 size_type max_size() const { return _M_ht.max_size(); } empty()174 bool empty() const { return _M_ht.empty(); } swap(_Self & __hs)175 void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } 176 begin()177 iterator begin() const { return _M_ht.begin(); } end()178 iterator end() const { return _M_ht.end(); } 179 180 public: insert(const value_type & __obj)181 pair<iterator, bool> insert(const value_type& __obj) 182 { 183 pair<_ht_iterator, bool> __p = _M_ht.insert_unique(__obj); 184 return pair<iterator, bool>(__p.first, __p.second); 185 } 186 #ifdef _STLP_MEMBER_TEMPLATES 187 template <class _InputIterator> insert(_InputIterator __f,_InputIterator __l)188 void insert(_InputIterator __f, _InputIterator __l) 189 { _M_ht.insert_unique(__f,__l); } 190 #else insert(const value_type * __f,const value_type * __l)191 void insert(const value_type* __f, const value_type* __l) { 192 _M_ht.insert_unique(__f,__l); 193 } insert(const_iterator __f,const_iterator __l)194 void insert(const_iterator __f, const_iterator __l) 195 {_M_ht.insert_unique(__f, __l); } 196 197 #endif /*_STLP_MEMBER_TEMPLATES */ insert_noresize(const value_type & __obj)198 pair<iterator, bool> insert_noresize(const value_type& __obj) 199 { 200 pair<_ht_iterator, bool> __p = 201 _M_ht.insert_unique_noresize(__obj); 202 return pair<iterator, bool>(__p.first, __p.second); 203 } 204 205 # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS ) 206 template <class _KT> find(const _KT & __key)207 iterator find(const _KT& __key) const { return _M_ht.find(__key); } 208 # else find(const key_type & __key)209 iterator find(const key_type& __key) const { return _M_ht.find(__key); } 210 # endif count(const key_type & __key)211 size_type count(const key_type& __key) const { return _M_ht.count(__key); } 212 equal_range(const key_type & __key)213 pair<iterator, iterator> equal_range(const key_type& __key) const 214 { return _M_ht.equal_range(__key); } 215 erase(const key_type & __key)216 size_type erase(const key_type& __key) {return _M_ht.erase(__key); } erase(iterator __it)217 void erase(iterator __it) { _M_ht.erase(__it); } erase(iterator __f,iterator __l)218 void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } clear()219 void clear() { _M_ht.clear(); } 220 221 public: resize(size_type __hint)222 void resize(size_type __hint) { _M_ht.resize(__hint); } bucket_count()223 size_type bucket_count() const { return _M_ht.bucket_count(); } max_bucket_count()224 size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } elems_in_bucket(size_type __n)225 size_type elems_in_bucket(size_type __n) const 226 { return _M_ht.elems_in_bucket(__n); } 227 _M_equal(const _Self & __x,const _Self & __y)228 static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) { 229 return _Ht::_M_equal(__x._M_ht,__y._M_ht); 230 } 231 232 }; 233 234 template <class _Value, __DFL_TMPL_PARAM(_HashFcn,hash<_Value>), 235 __DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>), 236 _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) > 237 class hash_multiset 238 { 239 private: 240 typedef hashtable<_Value, _Value, _HashFcn, _STLP_Identity<_Value>, 241 _EqualKey, _Alloc> _Ht; 242 typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self; 243 244 public: 245 typedef typename _Ht::key_type key_type; 246 typedef typename _Ht::value_type value_type; 247 typedef typename _Ht::hasher hasher; 248 typedef typename _Ht::key_equal key_equal; 249 250 typedef typename _Ht::size_type size_type; 251 typedef typename _Ht::difference_type difference_type; 252 typedef typename _Ht::pointer pointer; 253 typedef typename _Ht::const_pointer const_pointer; 254 typedef typename _Ht::reference reference; 255 typedef typename _Ht::const_reference const_reference; 256 257 typedef typename _Ht::const_iterator const_iterator; 258 // SunPro bug 259 typedef const_iterator iterator; 260 261 typedef typename _Ht::allocator_type allocator_type; 262 hash_funct()263 hasher hash_funct() const { return _M_ht.hash_funct(); } key_eq()264 key_equal key_eq() const { return _M_ht.key_eq(); } get_allocator()265 allocator_type get_allocator() const { return _M_ht.get_allocator(); } 266 267 private: 268 _Ht _M_ht; 269 270 public: 271 /// @deprecated Use std::unordered_multiset hash_multiset()272 NCBI_DEPRECATED hash_multiset() 273 : _M_ht(100, hasher(), key_equal(), allocator_type()) {} 274 /// @deprecated Use std::unordered_multiset hash_multiset(size_type __n)275 NCBI_DEPRECATED explicit hash_multiset(size_type __n) 276 : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} 277 /// @deprecated Use std::unordered_multiset hash_multiset(size_type __n,const hasher & __hf)278 NCBI_DEPRECATED hash_multiset(size_type __n, const hasher& __hf) 279 : _M_ht(__n, __hf, key_equal(), allocator_type()) {} 280 /// @deprecated Use std::unordered_multiset hash_multiset(size_type __n,const hasher & __hf,const key_equal & __eql)281 NCBI_DEPRECATED hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql) 282 : _M_ht(__n, __hf, __eql, allocator_type()) {} 283 /// @deprecated Use std::unordered_multiset hash_multiset(size_type __n,const hasher & __hf,const key_equal & __eql,const allocator_type & __a)284 NCBI_DEPRECATED hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, 285 const allocator_type& __a) 286 : _M_ht(__n, __hf, __eql, __a) {} 287 288 #ifdef _STLP_MEMBER_TEMPLATES 289 template <class _InputIterator> 290 /// @deprecated Use std::unordered_multiset hash_multiset(_InputIterator __f,_InputIterator __l)291 NCBI_DEPRECATED hash_multiset(_InputIterator __f, _InputIterator __l) 292 : _M_ht(100, hasher(), key_equal(), allocator_type()) 293 { _M_ht.insert_equal(__f, __l); } 294 template <class _InputIterator> 295 /// @deprecated Use std::unordered_multiset hash_multiset(_InputIterator __f,_InputIterator __l,size_type __n)296 NCBI_DEPRECATED hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) 297 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 298 { _M_ht.insert_equal(__f, __l); } 299 template <class _InputIterator> 300 /// @deprecated Use std::unordered_multiset hash_multiset(_InputIterator __f,_InputIterator __l,size_type __n,const hasher & __hf)301 NCBI_DEPRECATED hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, 302 const hasher& __hf) 303 : _M_ht(__n, __hf, key_equal(), allocator_type()) 304 { _M_ht.insert_equal(__f, __l); } 305 306 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 307 template <class _InputIterator> 308 /// @deprecated Use std::unordered_multiset hash_multiset(_InputIterator __f,_InputIterator __l,size_type __n,const hasher & __hf,const key_equal & __eql)309 NCBI_DEPRECATED hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, 310 const hasher& __hf, const key_equal& __eql) 311 : _M_ht(__n, __hf, __eql, allocator_type()) 312 { _M_ht.insert_equal(__f, __l); } 313 # endif 314 template <class _InputIterator> 315 /// @deprecated Use std::unordered_multiset hash_multiset(_InputIterator __f,_InputIterator __l,size_type __n,const hasher & __hf,const key_equal & __eql,const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)316 NCBI_DEPRECATED hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, 317 const hasher& __hf, const key_equal& __eql, 318 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) 319 : _M_ht(__n, __hf, __eql, __a) 320 { _M_ht.insert_equal(__f, __l); } 321 #else 322 323 /// @deprecated Use std::unordered_multiset hash_multiset(const value_type * __f,const value_type * __l)324 NCBI_DEPRECATED hash_multiset(const value_type* __f, const value_type* __l) 325 : _M_ht(100, hasher(), key_equal(), allocator_type()) 326 { _M_ht.insert_equal(__f, __l); } 327 /// @deprecated Use std::unordered_multiset hash_multiset(const value_type * __f,const value_type * __l,size_type __n)328 NCBI_DEPRECATED hash_multiset(const value_type* __f, const value_type* __l, size_type __n) 329 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 330 { _M_ht.insert_equal(__f, __l); } 331 /// @deprecated Use std::unordered_multiset hash_multiset(const value_type * __f,const value_type * __l,size_type __n,const hasher & __hf)332 NCBI_DEPRECATED hash_multiset(const value_type* __f, const value_type* __l, size_type __n, 333 const hasher& __hf) 334 : _M_ht(__n, __hf, key_equal(), allocator_type()) 335 { _M_ht.insert_equal(__f, __l); } 336 /// @deprecated Use std::unordered_multiset 337 NCBI_DEPRECATED hash_multiset(const value_type* __f, const value_type* __l, size_type __n, 338 const hasher& __hf, const key_equal& __eql, 339 const allocator_type& __a = allocator_type()) _M_ht(__n,__hf,__eql,__a)340 : _M_ht(__n, __hf, __eql, __a) 341 { _M_ht.insert_equal(__f, __l); } 342 343 /// @deprecated Use std::unordered_multiset hash_multiset(const_iterator __f,const_iterator __l)344 NCBI_DEPRECATED hash_multiset(const_iterator __f, const_iterator __l) 345 : _M_ht(100, hasher(), key_equal(), allocator_type()) 346 { _M_ht.insert_equal(__f, __l); } 347 /// @deprecated Use std::unordered_multiset hash_multiset(const_iterator __f,const_iterator __l,size_type __n)348 NCBI_DEPRECATED hash_multiset(const_iterator __f, const_iterator __l, size_type __n) 349 : _M_ht(__n, hasher(), key_equal(), allocator_type()) 350 { _M_ht.insert_equal(__f, __l); } 351 /// @deprecated Use std::unordered_multiset hash_multiset(const_iterator __f,const_iterator __l,size_type __n,const hasher & __hf)352 NCBI_DEPRECATED hash_multiset(const_iterator __f, const_iterator __l, size_type __n, 353 const hasher& __hf) 354 : _M_ht(__n, __hf, key_equal(), allocator_type()) 355 { _M_ht.insert_equal(__f, __l); } 356 /// @deprecated Use std::unordered_multiset 357 NCBI_DEPRECATED hash_multiset(const_iterator __f, const_iterator __l, size_type __n, 358 const hasher& __hf, const key_equal& __eql, 359 const allocator_type& __a = allocator_type()) _M_ht(__n,__hf,__eql,__a)360 : _M_ht(__n, __hf, __eql, __a) 361 { _M_ht.insert_equal(__f, __l); } 362 #endif /*_STLP_MEMBER_TEMPLATES */ 363 364 public: size()365 size_type size() const { return _M_ht.size(); } max_size()366 size_type max_size() const { return _M_ht.max_size(); } empty()367 bool empty() const { return _M_ht.empty(); } swap(_Self & hs)368 void swap(_Self& hs) { _M_ht.swap(hs._M_ht); } 369 begin()370 iterator begin() const { return _M_ht.begin(); } end()371 iterator end() const { return _M_ht.end(); } 372 373 public: insert(const value_type & __obj)374 iterator insert(const value_type& __obj) 375 { return _M_ht.insert_equal(__obj); } 376 #ifdef _STLP_MEMBER_TEMPLATES 377 template <class _InputIterator> insert(_InputIterator __f,_InputIterator __l)378 void insert(_InputIterator __f, _InputIterator __l) 379 { _M_ht.insert_equal(__f,__l); } 380 #else insert(const value_type * __f,const value_type * __l)381 void insert(const value_type* __f, const value_type* __l) { 382 _M_ht.insert_equal(__f,__l); 383 } insert(const_iterator __f,const_iterator __l)384 void insert(const_iterator __f, const_iterator __l) 385 { _M_ht.insert_equal(__f, __l); } 386 #endif /*_STLP_MEMBER_TEMPLATES */ insert_noresize(const value_type & __obj)387 iterator insert_noresize(const value_type& __obj) 388 { return _M_ht.insert_equal_noresize(__obj); } 389 390 # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS ) 391 template <class _KT> find(const _KT & __key)392 iterator find(const _KT& __key) const { return _M_ht.find(__key); } 393 # else find(const key_type & __key)394 iterator find(const key_type& __key) const { return _M_ht.find(__key); } 395 # endif 396 count(const key_type & __key)397 size_type count(const key_type& __key) const { return _M_ht.count(__key); } 398 equal_range(const key_type & __key)399 pair<iterator, iterator> equal_range(const key_type& __key) const 400 { return _M_ht.equal_range(__key); } 401 erase(const key_type & __key)402 size_type erase(const key_type& __key) {return _M_ht.erase(__key); } erase(iterator __it)403 void erase(iterator __it) { _M_ht.erase(__it); } erase(iterator __f,iterator __l)404 void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } clear()405 void clear() { _M_ht.clear(); } 406 407 public: resize(size_type __hint)408 void resize(size_type __hint) { _M_ht.resize(__hint); } bucket_count()409 size_type bucket_count() const { return _M_ht.bucket_count(); } max_bucket_count()410 size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } elems_in_bucket(size_type __n)411 size_type elems_in_bucket(size_type __n) const 412 { return _M_ht.elems_in_bucket(__n); } _M_equal(const _Self & __x,const _Self & __y)413 static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) { 414 return _Ht::_M_equal(__x._M_ht,__y._M_ht); 415 } 416 }; 417 418 #define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> 419 #define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc> 420 421 // MODIFIED - fixed path 422 #include <corelib/hash_impl/_relops_hash_cont.h> 423 424 #undef _STLP_TEMPLATE_CONTAINER 425 #define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc> 426 // MODIFIED - fixed path 427 #include <corelib/hash_impl/_relops_hash_cont.h> 428 429 #undef _STLP_TEMPLATE_CONTAINER 430 #undef _STLP_TEMPLATE_HEADER 431 432 // Specialization of insert_iterator so that it will work for hash_set 433 // and hash_multiset. 434 435 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION 436 437 template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> 438 class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > { 439 protected: 440 typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; 441 _Container* container; 442 public: 443 typedef _Container container_type; 444 typedef output_iterator_tag iterator_category; 445 typedef void value_type; 446 typedef void difference_type; 447 typedef void pointer; 448 typedef void reference; 449 insert_iterator(_Container & __x)450 insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container & __x,typename _Container::iterator)451 insert_iterator(_Container& __x, typename _Container::iterator) 452 : container(&__x) {} 453 insert_iterator<_Container>& 454 operator=(const typename _Container::value_type& __val) { 455 container->insert(__val); 456 return *this; 457 } 458 insert_iterator<_Container>& operator*() { return *this; } 459 insert_iterator<_Container>& operator++() { return *this; } 460 insert_iterator<_Container>& operator++(int) { return *this; } 461 }; 462 463 template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> 464 class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > { 465 protected: 466 typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; 467 _Container* container; 468 typename _Container::iterator iter; 469 public: 470 typedef _Container container_type; 471 typedef output_iterator_tag iterator_category; 472 typedef void value_type; 473 typedef void difference_type; 474 typedef void pointer; 475 typedef void reference; 476 insert_iterator(_Container & __x)477 insert_iterator(_Container& __x) : container(&__x) {} insert_iterator(_Container & __x,typename _Container::iterator)478 insert_iterator(_Container& __x, typename _Container::iterator) 479 : container(&__x) {} 480 insert_iterator<_Container>& 481 operator=(const typename _Container::value_type& __val) { 482 container->insert(__val); 483 return *this; 484 } 485 insert_iterator<_Container>& operator*() { return *this; } 486 insert_iterator<_Container>& operator++() { return *this; } 487 insert_iterator<_Container>& operator++(int) { return *this; } 488 }; 489 490 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ 491 _STLP_END_NAMESPACE 492 493 // do a cleanup 494 # undef hash_set 495 # undef hash_multiset 496 497 // provide a uniform way to access full funclionality 498 # define __hash_set__ __FULL_NAME(hash_set) 499 # define __hash_multiset__ __FULL_NAME(hash_multiset) 500 501 # if defined ( _STLP_USE_WRAPPER_FOR_ALLOC_PARAM ) 502 # include <stl/wrappers/_hash_set.h> 503 # endif /* WRAPPER */ 504 505 #endif /* _STLP_INTERNAL_HASH_SET_H */ 506 507 // Local Variables: 508 // mode:C++ 509 // End: 510 511