1.1 --- a/epoc32/include/stdapis/stlport/stl/_hash_set.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_hash_set.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,633 @@
1.4 -_hash_set.h
1.5 +/*
1.6 + *
1.7 + * Copyright (c) 1994
1.8 + * Hewlett-Packard Company
1.9 + *
1.10 + * Copyright (c) 1996,1997
1.11 + * Silicon Graphics Computer Systems, Inc.
1.12 + *
1.13 + * Copyright (c) 1997
1.14 + * Moscow Center for SPARC Technology
1.15 + *
1.16 + * Copyright (c) 1999
1.17 + * Boris Fomitchev
1.18 + *
1.19 + * This material is provided "as is", with absolutely no warranty expressed
1.20 + * or implied. Any use is at your own risk.
1.21 + *
1.22 + * Permission to use or copy this software for any purpose is hereby granted
1.23 + * without fee, provided the above notices are retained on all copies.
1.24 + * Permission to modify the code and to distribute modified code is granted,
1.25 + * provided the above notices are retained, and a notice that the code was
1.26 + * modified is included with the above copyright notice.
1.27 + *
1.28 + */
1.29 +
1.30 +/* NOTE: This is an internal header file, included by other STL headers.
1.31 + * You should not attempt to use it directly.
1.32 + */
1.33 +
1.34 +#ifndef _STLP_INTERNAL_HASH_SET_H
1.35 +#define _STLP_INTERNAL_HASH_SET_H
1.36 +
1.37 +#ifndef _STLP_INTERNAL_HASHTABLE_H
1.38 +# include <stl/_hashtable.h>
1.39 +#endif
1.40 +
1.41 +# define hash_set __WORKAROUND_RENAME(hash_set)
1.42 +# define hash_multiset __WORKAROUND_RENAME(hash_multiset)
1.43 +
1.44 +_STLP_BEGIN_NAMESPACE
1.45 +
1.46 +template <class _Value, __DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
1.47 + __DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
1.48 + _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
1.49 +class hash_set
1.50 +{
1.51 +private:
1.52 + typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
1.53 + _EqualKey, _Alloc> _Ht;
1.54 + typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
1.55 + typedef typename _Ht::iterator _ht_iterator;
1.56 +public:
1.57 + typedef typename _Ht::key_type key_type;
1.58 + typedef typename _Ht::value_type value_type;
1.59 + typedef typename _Ht::hasher hasher;
1.60 + typedef typename _Ht::key_equal key_equal;
1.61 +
1.62 + typedef typename _Ht::size_type size_type;
1.63 + typedef typename _Ht::difference_type difference_type;
1.64 + typedef typename _Ht::pointer pointer;
1.65 + typedef typename _Ht::const_pointer const_pointer;
1.66 + typedef typename _Ht::reference reference;
1.67 + typedef typename _Ht::const_reference const_reference;
1.68 +
1.69 + // SunPro bug
1.70 + typedef typename _Ht::const_iterator const_iterator;
1.71 + typedef const_iterator iterator;
1.72 +
1.73 + typedef typename _Ht::allocator_type allocator_type;
1.74 +
1.75 + hasher hash_funct() const { return _M_ht.hash_funct(); }
1.76 + key_equal key_eq() const { return _M_ht.key_eq(); }
1.77 + allocator_type get_allocator() const { return _M_ht.get_allocator(); }
1.78 +
1.79 +private:
1.80 + _Ht _M_ht;
1.81 +
1.82 +public:
1.83 + hash_set()
1.84 + : _M_ht(100, hasher(), key_equal(), allocator_type()) {
1.85 + _STLP_POP_IF_CHECK
1.86 + }
1.87 +
1.88 +# ifdef _STLP_USE_TRAP_LEAVE
1.89 + hash_set(const _Self& __o) :
1.90 + _M_ht(__o.size())
1.91 + {
1.92 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.93 + _M_ht = __o._M_ht;
1.94 + _STLP_POP_CLEANUP_ITEM
1.95 + }
1.96 +# else
1.97 + hash_set(const _Self& __o)
1.98 + : _M_ht(__o._M_ht) {
1.99 + }
1.100 +# endif
1.101 + explicit hash_set(size_type __n)
1.102 + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {
1.103 + _STLP_POP_IF_CHECK
1.104 + }
1.105 + hash_set(size_type __n, const hasher& __hf)
1.106 + : _M_ht(__n, __hf, key_equal(), allocator_type()) {
1.107 + _STLP_POP_IF_CHECK
1.108 + }
1.109 + hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
1.110 + const allocator_type& __a = allocator_type())
1.111 + : _M_ht(__n, __hf, __eql, __a) {
1.112 + _STLP_POP_IF_CHECK
1.113 + }
1.114 +
1.115 +#ifdef _STLP_MEMBER_TEMPLATES
1.116 + template <class _InputIterator>
1.117 + hash_set(_InputIterator __f, _InputIterator __l)
1.118 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.119 + {
1.120 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.121 + _M_ht.insert_unique(__f, __l);
1.122 + _STLP_POP_CLEANUP_ITEM
1.123 + }
1.124 + template <class _InputIterator>
1.125 + hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
1.126 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.127 + {
1.128 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.129 + _M_ht.insert_unique(__f, __l);
1.130 + _STLP_POP_CLEANUP_ITEM
1.131 + }
1.132 + template <class _InputIterator>
1.133 + hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
1.134 + const hasher& __hf)
1.135 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.136 + {
1.137 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.138 + _M_ht.insert_unique(__f, __l);
1.139 + _STLP_POP_CLEANUP_ITEM
1.140 + }
1.141 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.142 + template <class _InputIterator>
1.143 + hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
1.144 + const hasher& __hf, const key_equal& __eql)
1.145 + : _M_ht(__n, __hf, __eql, allocator_type())
1.146 + {
1.147 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.148 + _M_ht.insert_unique(__f, __l);
1.149 + _STLP_POP_CLEANUP_ITEM
1.150 + }
1.151 +# endif
1.152 + template <class _InputIterator>
1.153 + hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
1.154 + const hasher& __hf, const key_equal& __eql,
1.155 + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1.156 + : _M_ht(__n, __hf, __eql, __a)
1.157 + {
1.158 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.159 + _M_ht.insert_unique(__f, __l);
1.160 + _STLP_POP_CLEANUP_ITEM
1.161 + }
1.162 +#else
1.163 +
1.164 + hash_set(const value_type* __f, const value_type* __l)
1.165 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.166 + {
1.167 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.168 + _M_ht.insert_unique(__f, __l);
1.169 + _STLP_POP_CLEANUP_ITEM
1.170 + }
1.171 + hash_set(const value_type* __f, const value_type* __l, size_type __n)
1.172 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.173 + {
1.174 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.175 + _M_ht.insert_unique(__f, __l);
1.176 + _STLP_POP_CLEANUP_ITEM
1.177 + }
1.178 + hash_set(const value_type* __f, const value_type* __l, size_type __n,
1.179 + const hasher& __hf)
1.180 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.181 + {
1.182 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.183 + _M_ht.insert_unique(__f, __l);
1.184 + _STLP_POP_CLEANUP_ITEM
1.185 + }
1.186 + hash_set(const value_type* __f, const value_type* __l, size_type __n,
1.187 + const hasher& __hf, const key_equal& __eql,
1.188 + const allocator_type& __a = allocator_type())
1.189 + : _M_ht(__n, __hf, __eql, __a)
1.190 + {
1.191 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.192 + _M_ht.insert_unique(__f, __l);
1.193 + _STLP_POP_CLEANUP_ITEM
1.194 + }
1.195 +
1.196 + hash_set(const_iterator __f, const_iterator __l)
1.197 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.198 + {
1.199 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.200 + _M_ht.insert_unique(__f, __l);
1.201 + _STLP_POP_CLEANUP_ITEM
1.202 + }
1.203 + hash_set(const_iterator __f, const_iterator __l, size_type __n)
1.204 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.205 + {
1.206 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.207 + _M_ht.insert_unique(__f, __l);
1.208 + _STLP_POP_CLEANUP_ITEM
1.209 + }
1.210 + hash_set(const_iterator __f, const_iterator __l, size_type __n,
1.211 + const hasher& __hf)
1.212 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.213 + {
1.214 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.215 + _M_ht.insert_unique(__f, __l);
1.216 + _STLP_POP_CLEANUP_ITEM
1.217 + }
1.218 + hash_set(const_iterator __f, const_iterator __l, size_type __n,
1.219 + const hasher& __hf, const key_equal& __eql,
1.220 + const allocator_type& __a = allocator_type())
1.221 + : _M_ht(__n, __hf, __eql, __a)
1.222 + {
1.223 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.224 + _M_ht.insert_unique(__f, __l);
1.225 + _STLP_POP_CLEANUP_ITEM
1.226 + }
1.227 +#endif /*_STLP_MEMBER_TEMPLATES */
1.228 +
1.229 +#ifdef _STLP_USE_TRAP_LEAVE
1.230 +public:
1.231 + static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.232 + static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.233 +#endif
1.234 +
1.235 +public:
1.236 + size_type size() const { return _M_ht.size(); }
1.237 + size_type max_size() const { return _M_ht.max_size(); }
1.238 + bool empty() const { return _M_ht.empty(); }
1.239 + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
1.240 +
1.241 + iterator begin() const { return _M_ht.begin(); }
1.242 + iterator end() const { return _M_ht.end(); }
1.243 +
1.244 +public:
1.245 + pair<iterator, bool> insert(const value_type& __obj)
1.246 + {
1.247 + pair<_ht_iterator, bool> __p = _M_ht.insert_unique(__obj);
1.248 + return pair<iterator,bool>(__REINTERPRET_CAST(const iterator&, __p.first), __p.second);
1.249 + }
1.250 +#ifdef _STLP_MEMBER_TEMPLATES
1.251 + template <class _InputIterator>
1.252 + void insert(_InputIterator __f, _InputIterator __l)
1.253 + { _M_ht.insert_unique(__f,__l); }
1.254 +#else
1.255 + void insert(const value_type* __f, const value_type* __l) {
1.256 + _M_ht.insert_unique(__f,__l);
1.257 + }
1.258 + void insert(const_iterator __f, const_iterator __l)
1.259 + {_M_ht.insert_unique(__f, __l); }
1.260 +
1.261 +#endif /*_STLP_MEMBER_TEMPLATES */
1.262 + pair<iterator, bool> insert_noresize(const value_type& __obj)
1.263 + {
1.264 + pair<_ht_iterator, bool> __p =
1.265 + _M_ht.insert_unique_noresize(__obj);
1.266 + return pair<iterator, bool>(__p.first, __p.second);
1.267 + }
1.268 +
1.269 +# if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )
1.270 + template <class _KT>
1.271 + iterator find(const _KT& __key) const { return _M_ht.find(__key); }
1.272 +# else
1.273 + iterator find(const key_type& __key) const { return _M_ht.find(__key); }
1.274 +# endif
1.275 + size_type count(const key_type& __key) const { return _M_ht.count(__key); }
1.276 +
1.277 + pair<iterator, iterator> equal_range(const key_type& __key) const
1.278 + { return _M_ht.equal_range(__key); }
1.279 +
1.280 + size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
1.281 + void erase(iterator __it) { _M_ht.erase(__it); }
1.282 + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
1.283 + void clear() { _M_ht.clear(); }
1.284 +
1.285 +public:
1.286 + void resize(size_type __hint) { _M_ht.resize(__hint); }
1.287 + size_type bucket_count() const { return _M_ht.bucket_count(); }
1.288 + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
1.289 + size_type elems_in_bucket(size_type __n) const
1.290 + { return _M_ht.elems_in_bucket(__n); }
1.291 +
1.292 + static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
1.293 + return _Ht::_M_equal(__x._M_ht,__y._M_ht);
1.294 + }
1.295 +
1.296 +};
1.297 +
1.298 +template <class _Value, __DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
1.299 + __DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
1.300 + _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
1.301 +class hash_multiset
1.302 +{
1.303 +private:
1.304 + typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
1.305 + _EqualKey, _Alloc> _Ht;
1.306 + typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
1.307 +
1.308 +public:
1.309 + typedef typename _Ht::key_type key_type;
1.310 + typedef typename _Ht::value_type value_type;
1.311 + typedef typename _Ht::hasher hasher;
1.312 + typedef typename _Ht::key_equal key_equal;
1.313 +
1.314 + typedef typename _Ht::size_type size_type;
1.315 + typedef typename _Ht::difference_type difference_type;
1.316 + typedef typename _Ht::pointer pointer;
1.317 + typedef typename _Ht::const_pointer const_pointer;
1.318 + typedef typename _Ht::reference reference;
1.319 + typedef typename _Ht::const_reference const_reference;
1.320 +
1.321 + typedef typename _Ht::const_iterator const_iterator;
1.322 + // SunPro bug
1.323 + typedef const_iterator iterator;
1.324 +
1.325 + typedef typename _Ht::allocator_type allocator_type;
1.326 +
1.327 + hasher hash_funct() const { return _M_ht.hash_funct(); }
1.328 + key_equal key_eq() const { return _M_ht.key_eq(); }
1.329 + allocator_type get_allocator() const { return _M_ht.get_allocator(); }
1.330 +
1.331 +private:
1.332 + _Ht _M_ht;
1.333 +
1.334 +public:
1.335 + hash_multiset()
1.336 + : _M_ht(100, hasher(), key_equal(), allocator_type()) {
1.337 + _STLP_POP_IF_CHECK
1.338 + }
1.339 +
1.340 +# ifdef _STLP_USE_TRAP_LEAVE
1.341 + hash_multiset(const _Self& __o) :
1.342 + _M_ht(__o.size())
1.343 + {
1.344 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.345 + _M_ht = __o._M_ht;
1.346 + _STLP_POP_CLEANUP_ITEM
1.347 + }
1.348 +# else
1.349 + hash_multiset(const _Self& __o)
1.350 + : _M_ht(__o._M_ht) {
1.351 + }
1.352 +# endif
1.353 +
1.354 + explicit hash_multiset(size_type __n)
1.355 + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {
1.356 + _STLP_POP_IF_CHECK
1.357 + }
1.358 + hash_multiset(size_type __n, const hasher& __hf)
1.359 + : _M_ht(__n, __hf, key_equal(), allocator_type()) {
1.360 + _STLP_POP_IF_CHECK
1.361 + }
1.362 + hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
1.363 + : _M_ht(__n, __hf, __eql, allocator_type()) {
1.364 + _STLP_POP_IF_CHECK
1.365 + }
1.366 + hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
1.367 + const allocator_type& __a)
1.368 + : _M_ht(__n, __hf, __eql, __a) {
1.369 + _STLP_POP_IF_CHECK
1.370 + }
1.371 +
1.372 +#ifdef _STLP_MEMBER_TEMPLATES
1.373 + template <class _InputIterator>
1.374 + hash_multiset(_InputIterator __f, _InputIterator __l)
1.375 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.376 + {
1.377 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.378 + _M_ht.insert_equal(__f, __l);
1.379 + _STLP_POP_CLEANUP_ITEM
1.380 + }
1.381 + template <class _InputIterator>
1.382 + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
1.383 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.384 + {
1.385 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.386 + _M_ht.insert_equal(__f, __l);
1.387 + _STLP_POP_CLEANUP_ITEM
1.388 + }
1.389 + template <class _InputIterator>
1.390 + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
1.391 + const hasher& __hf)
1.392 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.393 + {
1.394 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.395 + _M_ht.insert_equal(__f, __l);
1.396 + _STLP_POP_CLEANUP_ITEM
1.397 + }
1.398 +
1.399 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.400 + template <class _InputIterator>
1.401 + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
1.402 + const hasher& __hf, const key_equal& __eql)
1.403 + : _M_ht(__n, __hf, __eql, allocator_type())
1.404 + {
1.405 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.406 + _M_ht.insert_equal(__f, __l);
1.407 + _STLP_POP_CLEANUP_ITEM
1.408 + }
1.409 +# endif
1.410 + template <class _InputIterator>
1.411 + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
1.412 + const hasher& __hf, const key_equal& __eql,
1.413 + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1.414 + : _M_ht(__n, __hf, __eql, __a)
1.415 + {
1.416 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.417 + _M_ht.insert_equal(__f, __l);
1.418 + _STLP_POP_CLEANUP_ITEM
1.419 + }
1.420 +#else
1.421 +
1.422 + hash_multiset(const value_type* __f, const value_type* __l)
1.423 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.424 + {
1.425 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.426 + _M_ht.insert_equal(__f, __l);
1.427 + _STLP_POP_CLEANUP_ITEM
1.428 + }
1.429 + hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
1.430 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.431 + {
1.432 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.433 + _M_ht.insert_equal(__f, __l);
1.434 + _STLP_POP_CLEANUP_ITEM
1.435 + }
1.436 + hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
1.437 + const hasher& __hf)
1.438 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.439 + {
1.440 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.441 + _M_ht.insert_equal(__f, __l);
1.442 + _STLP_POP_CLEANUP_ITEM
1.443 + }
1.444 + hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
1.445 + const hasher& __hf, const key_equal& __eql,
1.446 + const allocator_type& __a = allocator_type())
1.447 + : _M_ht(__n, __hf, __eql, __a)
1.448 + {
1.449 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.450 + _M_ht.insert_equal(__f, __l);
1.451 + _STLP_POP_CLEANUP_ITEM
1.452 + }
1.453 +
1.454 + hash_multiset(const_iterator __f, const_iterator __l)
1.455 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.456 + {
1.457 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.458 + _M_ht.insert_equal(__f, __l);
1.459 + _STLP_POP_CLEANUP_ITEM
1.460 + }
1.461 + hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
1.462 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.463 + {
1.464 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.465 + _M_ht.insert_equal(__f, __l);
1.466 + _STLP_POP_CLEANUP_ITEM
1.467 + }
1.468 + hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
1.469 + const hasher& __hf)
1.470 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.471 + {
1.472 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.473 + _M_ht.insert_equal(__f, __l);
1.474 + _STLP_POP_CLEANUP_ITEM
1.475 + }
1.476 + hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
1.477 + const hasher& __hf, const key_equal& __eql,
1.478 + const allocator_type& __a = allocator_type())
1.479 + : _M_ht(__n, __hf, __eql, __a)
1.480 + {
1.481 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.482 + _M_ht.insert_equal(__f, __l);
1.483 + _STLP_POP_CLEANUP_ITEM
1.484 + }
1.485 +#endif /*_STLP_MEMBER_TEMPLATES */
1.486 +
1.487 +#ifdef _STLP_USE_TRAP_LEAVE
1.488 +public:
1.489 + static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.490 + static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.491 +#endif
1.492 +
1.493 +public:
1.494 + size_type size() const { return _M_ht.size(); }
1.495 + size_type max_size() const { return _M_ht.max_size(); }
1.496 + bool empty() const { return _M_ht.empty(); }
1.497 + void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
1.498 +
1.499 + iterator begin() const { return _M_ht.begin(); }
1.500 + iterator end() const { return _M_ht.end(); }
1.501 +
1.502 +public:
1.503 + iterator insert(const value_type& __obj)
1.504 + { return _M_ht.insert_equal(__obj); }
1.505 +#ifdef _STLP_MEMBER_TEMPLATES
1.506 + template <class _InputIterator>
1.507 + void insert(_InputIterator __f, _InputIterator __l)
1.508 + { _M_ht.insert_equal(__f,__l); }
1.509 +#else
1.510 + void insert(const value_type* __f, const value_type* __l) {
1.511 + _M_ht.insert_equal(__f,__l);
1.512 + }
1.513 + void insert(const_iterator __f, const_iterator __l)
1.514 + { _M_ht.insert_equal(__f, __l); }
1.515 +#endif /*_STLP_MEMBER_TEMPLATES */
1.516 + iterator insert_noresize(const value_type& __obj)
1.517 + { return _M_ht.insert_equal_noresize(__obj); }
1.518 +
1.519 +# if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )
1.520 + template <class _KT>
1.521 + iterator find(const _KT& __key) const { return _M_ht.find(__key); }
1.522 +# else
1.523 + iterator find(const key_type& __key) const { return _M_ht.find(__key); }
1.524 +# endif
1.525 +
1.526 + size_type count(const key_type& __key) const { return _M_ht.count(__key); }
1.527 +
1.528 + pair<iterator, iterator> equal_range(const key_type& __key) const
1.529 + { return _M_ht.equal_range(__key); }
1.530 +
1.531 + size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
1.532 + void erase(iterator __it) { _M_ht.erase(__it); }
1.533 + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
1.534 + void clear() { _M_ht.clear(); }
1.535 +
1.536 +public:
1.537 + void resize(size_type __hint) { _M_ht.resize(__hint); }
1.538 + size_type bucket_count() const { return _M_ht.bucket_count(); }
1.539 + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
1.540 + size_type elems_in_bucket(size_type __n) const
1.541 + { return _M_ht.elems_in_bucket(__n); }
1.542 + static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
1.543 + return _Ht::_M_equal(__x._M_ht,__y._M_ht);
1.544 + }
1.545 +};
1.546 +
1.547 +#define _STLP_TEMPLATE_HEADER template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
1.548 +#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc>
1.549 +
1.550 +#include <stl/_relops_hash_cont.h>
1.551 +
1.552 +#undef _STLP_TEMPLATE_CONTAINER
1.553 +#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>
1.554 +#include <stl/_relops_hash_cont.h>
1.555 +
1.556 +#undef _STLP_TEMPLATE_CONTAINER
1.557 +#undef _STLP_TEMPLATE_HEADER
1.558 +
1.559 +// Specialization of insert_iterator so that it will work for hash_set
1.560 +// and hash_multiset.
1.561 +
1.562 +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
1.563 +
1.564 +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
1.565 +class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
1.566 +protected:
1.567 + typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
1.568 + _Container* container;
1.569 +public:
1.570 + typedef _Container container_type;
1.571 + typedef output_iterator_tag iterator_category;
1.572 + typedef void value_type;
1.573 + typedef void difference_type;
1.574 + typedef void pointer;
1.575 + typedef void reference;
1.576 +
1.577 + insert_iterator(_Container& __x) : container(&__x) {}
1.578 + insert_iterator(_Container& __x, typename _Container::iterator)
1.579 + : container(&__x) {}
1.580 + insert_iterator<_Container>&
1.581 + operator=(const typename _Container::value_type& __val) {
1.582 + container->insert(__val);
1.583 + return *this;
1.584 + }
1.585 + insert_iterator<_Container>& operator*() { return *this; }
1.586 + insert_iterator<_Container>& operator++() { return *this; }
1.587 + insert_iterator<_Container>& operator++(int) { return *this; }
1.588 +};
1.589 +
1.590 +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
1.591 +class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
1.592 +protected:
1.593 + typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
1.594 + _Container* container;
1.595 + typename _Container::iterator iter;
1.596 +public:
1.597 + typedef _Container container_type;
1.598 + typedef output_iterator_tag iterator_category;
1.599 + typedef void value_type;
1.600 + typedef void difference_type;
1.601 + typedef void pointer;
1.602 + typedef void reference;
1.603 +
1.604 + insert_iterator(_Container& __x) : container(&__x) {}
1.605 + insert_iterator(_Container& __x, typename _Container::iterator)
1.606 + : container(&__x) {}
1.607 + insert_iterator<_Container>&
1.608 + operator=(const typename _Container::value_type& __val) {
1.609 + container->insert(__val);
1.610 + return *this;
1.611 + }
1.612 + insert_iterator<_Container>& operator*() { return *this; }
1.613 + insert_iterator<_Container>& operator++() { return *this; }
1.614 + insert_iterator<_Container>& operator++(int) { return *this; }
1.615 +};
1.616 +
1.617 +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.618 +_STLP_END_NAMESPACE
1.619 +
1.620 +// do a cleanup
1.621 +# undef hash_set
1.622 +# undef hash_multiset
1.623 +
1.624 +// provide a uniform way to access full funclionality
1.625 +# define __hash_set__ __FULL_NAME(hash_set)
1.626 +# define __hash_multiset__ __FULL_NAME(hash_multiset)
1.627 +
1.628 +# if defined ( _STLP_USE_WRAPPER_FOR_ALLOC_PARAM )
1.629 +# include <stl/wrappers/_hash_set.h>
1.630 +# endif /* WRAPPER */
1.631 +
1.632 +#endif /* _STLP_INTERNAL_HASH_SET_H */
1.633 +
1.634 +// Local Variables:
1.635 +// mode:C++
1.636 +// End:
1.637 +