1.1 --- a/epoc32/include/stdapis/stlport/stl/_hash_map.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_hash_map.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,635 @@
1.4 -_hash_map.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_MAP_H
1.35 +#define _STLP_INTERNAL_HASH_MAP_H
1.36 +
1.37 +#ifndef _STLP_INTERNAL_HASHTABLE_H
1.38 +# include <stl/_hashtable.h>
1.39 +#endif
1.40 +
1.41 +_STLP_BEGIN_NAMESPACE
1.42 +
1.43 +# define hash_map __WORKAROUND_RENAME(hash_map)
1.44 +# define hash_multimap __WORKAROUND_RENAME(hash_multimap)
1.45 +
1.46 +# define _STLP_KEY_PAIR pair< const _Key, _Tp >
1.47 +# define _STLP_HASHTABLE hashtable \
1.48 + < pair < const _Key, _Tp >, _Key, _HashFcn, \
1.49 + _STLP_SELECT1ST( _STLP_KEY_PAIR, _Key ), _EqualKey, _Alloc >
1.50 +
1.51 +template <class _Key, class _Tp, __DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
1.52 + __DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
1.53 + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
1.54 +class hash_map
1.55 +{
1.56 +private:
1.57 + typedef _STLP_HASHTABLE _Ht;
1.58 + typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
1.59 +public:
1.60 + typedef typename _Ht::key_type key_type;
1.61 + typedef _Tp data_type;
1.62 + typedef _Tp mapped_type;
1.63 + typedef typename _Ht::value_type _value_type;
1.64 + typedef typename _Ht::value_type value_type;
1.65 + typedef typename _Ht::hasher hasher;
1.66 + typedef typename _Ht::key_equal key_equal;
1.67 +
1.68 + typedef typename _Ht::size_type size_type;
1.69 + typedef typename _Ht::difference_type difference_type;
1.70 + typedef typename _Ht::pointer pointer;
1.71 + typedef typename _Ht::const_pointer const_pointer;
1.72 + typedef typename _Ht::reference reference;
1.73 + typedef typename _Ht::const_reference const_reference;
1.74 +
1.75 + typedef typename _Ht::iterator iterator;
1.76 + typedef typename _Ht::const_iterator const_iterator;
1.77 +
1.78 + typedef typename _Ht::allocator_type allocator_type;
1.79 +
1.80 + hasher hash_funct() const { return _M_ht.hash_funct(); }
1.81 + key_equal key_eq() const { return _M_ht.key_eq(); }
1.82 + allocator_type get_allocator() const { return _M_ht.get_allocator(); }
1.83 +
1.84 +private:
1.85 + _Ht _M_ht;
1.86 +public:
1.87 + hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {
1.88 + _STLP_POP_IF_CHECK
1.89 + }
1.90 + explicit hash_map(size_type __n)
1.91 + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {
1.92 + _STLP_POP_IF_CHECK
1.93 + }
1.94 +
1.95 +
1.96 +# ifdef _STLP_USE_TRAP_LEAVE
1.97 + hash_map(const _Self& __o) :
1.98 + _M_ht(__o.size())
1.99 + {
1.100 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.101 + _M_ht = __o._M_ht;
1.102 + _STLP_POP_CLEANUP_ITEM
1.103 + }
1.104 +# else
1.105 + hash_map(const _Self& __o)
1.106 + : _M_ht(__o._M_ht) {
1.107 + }
1.108 +# endif
1.109 +
1.110 + hash_map(size_type __n, const hasher& __hf)
1.111 + : _M_ht(__n, __hf, key_equal(), allocator_type()) {
1.112 + _STLP_POP_IF_CHECK
1.113 + }
1.114 + hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
1.115 + const allocator_type& __a = allocator_type())
1.116 + : _M_ht(__n, __hf, __eql, __a) {
1.117 + _STLP_POP_IF_CHECK
1.118 + }
1.119 +
1.120 +#ifdef _STLP_MEMBER_TEMPLATES
1.121 + template <class _InputIterator>
1.122 + hash_map(_InputIterator __f, _InputIterator __l)
1.123 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.124 + {
1.125 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.126 + _M_ht.insert_unique(__f, __l);
1.127 + _STLP_POP_CLEANUP_ITEM
1.128 + }
1.129 + template <class _InputIterator>
1.130 + hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
1.131 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.132 + {
1.133 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.134 + _M_ht.insert_unique(__f, __l);
1.135 + _STLP_POP_CLEANUP_ITEM
1.136 + }
1.137 + template <class _InputIterator>
1.138 + hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
1.139 + const hasher& __hf)
1.140 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.141 + {
1.142 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.143 + _M_ht.insert_unique(__f, __l);
1.144 + _STLP_POP_CLEANUP_ITEM
1.145 + }
1.146 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.147 + template <class _InputIterator>
1.148 + hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
1.149 + const hasher& __hf, const key_equal& __eql)
1.150 + : _M_ht(__n, __hf, __eql, allocator_type())
1.151 + {
1.152 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.153 + _M_ht.insert_unique(__f, __l);
1.154 + _STLP_POP_CLEANUP_ITEM
1.155 + }
1.156 +# endif
1.157 + template <class _InputIterator>
1.158 + hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
1.159 + const hasher& __hf, const key_equal& __eql,
1.160 + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1.161 + : _M_ht(__n, __hf, __eql, __a)
1.162 + {
1.163 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.164 + _M_ht.insert_unique(__f, __l);
1.165 + _STLP_POP_CLEANUP_ITEM
1.166 + }
1.167 +
1.168 +#else
1.169 + hash_map(const value_type* __f, const value_type* __l)
1.170 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.171 + {
1.172 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.173 + _M_ht.insert_unique(__f, __l);
1.174 + _STLP_POP_CLEANUP_ITEM
1.175 + }
1.176 + hash_map(const value_type* __f, const value_type* __l, size_type __n)
1.177 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.178 + {
1.179 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.180 + _M_ht.insert_unique(__f, __l);
1.181 + _STLP_POP_CLEANUP_ITEM
1.182 + }
1.183 + hash_map(const value_type* __f, const value_type* __l, size_type __n,
1.184 + const hasher& __hf)
1.185 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.186 + {
1.187 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.188 + _M_ht.insert_unique(__f, __l);
1.189 + _STLP_POP_CLEANUP_ITEM
1.190 + }
1.191 + hash_map(const value_type* __f, const value_type* __l, size_type __n,
1.192 + const hasher& __hf, const key_equal& __eql,
1.193 + const allocator_type& __a = allocator_type())
1.194 + : _M_ht(__n, __hf, __eql, __a)
1.195 + {
1.196 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.197 + _M_ht.insert_unique(__f, __l);
1.198 + _STLP_POP_CLEANUP_ITEM
1.199 + }
1.200 +
1.201 + hash_map(const_iterator __f, const_iterator __l)
1.202 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.203 + {
1.204 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.205 + _M_ht.insert_unique(__f, __l);
1.206 + _STLP_POP_CLEANUP_ITEM
1.207 + }
1.208 + hash_map(const_iterator __f, const_iterator __l, size_type __n)
1.209 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.210 + {
1.211 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.212 + _M_ht.insert_unique(__f, __l);
1.213 + _STLP_POP_CLEANUP_ITEM
1.214 + }
1.215 + hash_map(const_iterator __f, const_iterator __l, size_type __n,
1.216 + const hasher& __hf)
1.217 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.218 + {
1.219 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.220 + _M_ht.insert_unique(__f, __l);
1.221 + _STLP_POP_CLEANUP_ITEM
1.222 + }
1.223 + hash_map(const_iterator __f, const_iterator __l, size_type __n,
1.224 + const hasher& __hf, const key_equal& __eql,
1.225 + const allocator_type& __a = allocator_type())
1.226 + : _M_ht(__n, __hf, __eql, __a)
1.227 + {
1.228 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.229 + _M_ht.insert_unique(__f, __l);
1.230 + _STLP_POP_CLEANUP_ITEM
1.231 + }
1.232 +#endif /*_STLP_MEMBER_TEMPLATES */
1.233 +
1.234 +#ifdef _STLP_USE_TRAP_LEAVE
1.235 +public:
1.236 + static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.237 + static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.238 +#endif
1.239 +
1.240 +public:
1.241 + size_type size() const { return _M_ht.size(); }
1.242 + size_type max_size() const { return _M_ht.max_size(); }
1.243 + bool empty() const { return _M_ht.empty(); }
1.244 + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
1.245 + iterator begin() { return _M_ht.begin(); }
1.246 + iterator end() { return _M_ht.end(); }
1.247 + const_iterator begin() const { return _M_ht.begin(); }
1.248 + const_iterator end() const { return _M_ht.end(); }
1.249 +
1.250 +public:
1.251 + pair<iterator,bool> insert(const value_type& __obj)
1.252 + { return _M_ht.insert_unique(__obj); }
1.253 +#ifdef _STLP_MEMBER_TEMPLATES
1.254 + template <class _InputIterator>
1.255 + void insert(_InputIterator __f, _InputIterator __l)
1.256 + { _M_ht.insert_unique(__f,__l); }
1.257 +#else
1.258 + void insert(const value_type* __f, const value_type* __l) {
1.259 + _M_ht.insert_unique(__f,__l);
1.260 + }
1.261 + void insert(const_iterator __f, const_iterator __l)
1.262 + { _M_ht.insert_unique(__f, __l); }
1.263 +#endif /*_STLP_MEMBER_TEMPLATES */
1.264 + pair<iterator,bool> insert_noresize(const value_type& __obj)
1.265 + { return _M_ht.insert_unique_noresize(__obj); }
1.266 +
1.267 + iterator find(const key_type& __key) { return _M_ht.find(__key); }
1.268 + const_iterator find(const key_type& __key) const { return _M_ht.find(__key); }
1.269 +
1.270 + _Tp& operator[](const key_type& __key) {
1.271 + iterator __it = _M_ht.find(__key);
1.272 + if (__it != _M_ht.end()) {
1.273 + return (*__it).second ;
1.274 + } else {
1.275 + value_type __tmp(__key, __false_type());
1.276 + _STLP_PUSH_STACK_ITEM(value_type, &__tmp)
1.277 + return _M_ht._M_insert(__tmp).second;
1.278 + }
1.279 + }
1.280 +
1.281 + size_type count(const key_type& __key) const { return _M_ht.count(__key); }
1.282 +
1.283 + pair<iterator, iterator> equal_range(const key_type& __key)
1.284 + { return _M_ht.equal_range(__key); }
1.285 + pair<const_iterator, const_iterator>
1.286 + equal_range(const key_type& __key) const
1.287 + { return _M_ht.equal_range(__key); }
1.288 +
1.289 + size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
1.290 + void erase(iterator __it) { _M_ht.erase(__it); }
1.291 + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
1.292 + void clear() { _M_ht.clear(); }
1.293 +
1.294 + void resize(size_type __hint) { _M_ht.resize(__hint); }
1.295 + size_type bucket_count() const { return _M_ht.bucket_count(); }
1.296 + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
1.297 + size_type elems_in_bucket(size_type __n) const
1.298 + { return _M_ht.elems_in_bucket(__n); }
1.299 + static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
1.300 + return _Ht::_M_equal(__x._M_ht,__y._M_ht);
1.301 + }
1.302 +};
1.303 +
1.304 +template <class _Key, class _Tp, __DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
1.305 + __DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
1.306 + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
1.307 +class hash_multimap
1.308 +{
1.309 +private:
1.310 + typedef _STLP_HASHTABLE _Ht;
1.311 + typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
1.312 +public:
1.313 + typedef typename _Ht::key_type key_type;
1.314 + typedef _Tp data_type;
1.315 + typedef _Tp mapped_type;
1.316 + typedef typename _Ht::value_type _value_type;
1.317 + typedef _value_type value_type;
1.318 + typedef typename _Ht::hasher hasher;
1.319 + typedef typename _Ht::key_equal key_equal;
1.320 +
1.321 + typedef typename _Ht::size_type size_type;
1.322 + typedef typename _Ht::difference_type difference_type;
1.323 + typedef typename _Ht::pointer pointer;
1.324 + typedef typename _Ht::const_pointer const_pointer;
1.325 + typedef typename _Ht::reference reference;
1.326 + typedef typename _Ht::const_reference const_reference;
1.327 +
1.328 + typedef typename _Ht::iterator iterator;
1.329 + typedef typename _Ht::const_iterator const_iterator;
1.330 +
1.331 + typedef typename _Ht::allocator_type allocator_type;
1.332 +
1.333 + hasher hash_funct() const { return _M_ht.hash_funct(); }
1.334 + key_equal key_eq() const { return _M_ht.key_eq(); }
1.335 + allocator_type get_allocator() const { return _M_ht.get_allocator(); }
1.336 +
1.337 +private:
1.338 + _Ht _M_ht;
1.339 +public:
1.340 + hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {
1.341 + _STLP_POP_IF_CHECK
1.342 + }
1.343 +
1.344 +# ifdef _STLP_USE_TRAP_LEAVE
1.345 + hash_multimap(const _Self& __o) :
1.346 + _M_ht(__o.size())
1.347 + {
1.348 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.349 + _M_ht = __o._M_ht;
1.350 + _STLP_POP_CLEANUP_ITEM
1.351 + }
1.352 +# else
1.353 + hash_multimap(const _Self& __o)
1.354 + : _M_ht(__o._M_ht) {
1.355 + }
1.356 +# endif
1.357 +
1.358 + explicit hash_multimap(size_type __n)
1.359 + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {
1.360 + _STLP_POP_IF_CHECK
1.361 + }
1.362 + hash_multimap(size_type __n, const hasher& __hf)
1.363 + : _M_ht(__n, __hf, key_equal(), allocator_type()) {
1.364 + _STLP_POP_IF_CHECK
1.365 + }
1.366 + hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
1.367 + const allocator_type& __a = allocator_type())
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_multimap(_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_multimap(_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_multimap(_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 +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.399 + template <class _InputIterator>
1.400 + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
1.401 + const hasher& __hf, const key_equal& __eql)
1.402 + : _M_ht(__n, __hf, __eql, allocator_type())
1.403 + {
1.404 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.405 + _M_ht.insert_equal(__f, __l);
1.406 + _STLP_POP_CLEANUP_ITEM
1.407 + }
1.408 +# endif
1.409 + template <class _InputIterator>
1.410 + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
1.411 + const hasher& __hf, const key_equal& __eql,
1.412 + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1.413 + : _M_ht(__n, __hf, __eql, __a)
1.414 + {
1.415 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.416 + _M_ht.insert_equal(__f, __l);
1.417 + _STLP_POP_CLEANUP_ITEM
1.418 + }
1.419 +
1.420 +#else
1.421 + hash_multimap(const value_type* __f, const value_type* __l)
1.422 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.423 + {
1.424 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.425 + _M_ht.insert_equal(__f, __l);
1.426 + _STLP_POP_CLEANUP_ITEM
1.427 + }
1.428 + hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
1.429 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.430 + {
1.431 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.432 + _M_ht.insert_equal(__f, __l);
1.433 + _STLP_POP_CLEANUP_ITEM
1.434 + }
1.435 + hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
1.436 + const hasher& __hf)
1.437 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.438 + {
1.439 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.440 + _M_ht.insert_equal(__f, __l);
1.441 + _STLP_POP_CLEANUP_ITEM
1.442 + }
1.443 + hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
1.444 + const hasher& __hf, const key_equal& __eql,
1.445 + const allocator_type& __a = allocator_type())
1.446 + : _M_ht(__n, __hf, __eql, __a)
1.447 + {
1.448 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.449 + _M_ht.insert_equal(__f, __l);
1.450 + _STLP_POP_CLEANUP_ITEM
1.451 + }
1.452 +
1.453 + hash_multimap(const_iterator __f, const_iterator __l)
1.454 + : _M_ht(100, hasher(), key_equal(), allocator_type())
1.455 + {
1.456 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.457 + _M_ht.insert_equal(__f, __l);
1.458 + _STLP_POP_CLEANUP_ITEM
1.459 + }
1.460 + hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
1.461 + : _M_ht(__n, hasher(), key_equal(), allocator_type())
1.462 + {
1.463 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.464 + _M_ht.insert_equal(__f, __l);
1.465 + _STLP_POP_CLEANUP_ITEM
1.466 + }
1.467 + hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
1.468 + const hasher& __hf)
1.469 + : _M_ht(__n, __hf, key_equal(), allocator_type())
1.470 + {
1.471 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.472 + _M_ht.insert_equal(__f, __l);
1.473 + _STLP_POP_CLEANUP_ITEM
1.474 + }
1.475 + hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
1.476 + const hasher& __hf, const key_equal& __eql,
1.477 + const allocator_type& __a = allocator_type())
1.478 + : _M_ht(__n, __hf, __eql, __a)
1.479 + {
1.480 + _STLP_PUSH_CLEANUP_ITEM(_Self, this)
1.481 + _M_ht.insert_equal(__f, __l);
1.482 + _STLP_POP_CLEANUP_ITEM
1.483 + }
1.484 +#endif /*_STLP_MEMBER_TEMPLATES */
1.485 +
1.486 +#ifdef _STLP_USE_TRAP_LEAVE
1.487 +public:
1.488 + static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.489 + static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.490 +#endif
1.491 +
1.492 +public:
1.493 + size_type size() const { return _M_ht.size(); }
1.494 + size_type max_size() const { return _M_ht.max_size(); }
1.495 + bool empty() const { return _M_ht.empty(); }
1.496 + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
1.497 +
1.498 + iterator begin() { return _M_ht.begin(); }
1.499 + iterator end() { return _M_ht.end(); }
1.500 + const_iterator begin() const { return _M_ht.begin(); }
1.501 + const_iterator end() const { return _M_ht.end(); }
1.502 +
1.503 +public:
1.504 + iterator insert(const value_type& __obj)
1.505 + { return _M_ht.insert_equal(__obj); }
1.506 +#ifdef _STLP_MEMBER_TEMPLATES
1.507 + template <class _InputIterator>
1.508 + void insert(_InputIterator __f, _InputIterator __l)
1.509 + { _M_ht.insert_equal(__f,__l); }
1.510 +#else
1.511 + void insert(const value_type* __f, const value_type* __l) {
1.512 + _M_ht.insert_equal(__f,__l);
1.513 + }
1.514 + void insert(const_iterator __f, const_iterator __l)
1.515 + { _M_ht.insert_equal(__f, __l); }
1.516 +#endif /*_STLP_MEMBER_TEMPLATES */
1.517 + iterator insert_noresize(const value_type& __obj)
1.518 + { return _M_ht.insert_equal_noresize(__obj); }
1.519 +
1.520 + iterator find(const key_type& __key) { return _M_ht.find(__key); }
1.521 + const_iterator find(const key_type& __key) const
1.522 + { return _M_ht.find(__key); }
1.523 +
1.524 + size_type count(const key_type& __key) const { return _M_ht.count(__key); }
1.525 +
1.526 + pair<iterator, iterator> equal_range(const key_type& __key)
1.527 + { return _M_ht.equal_range(__key); }
1.528 + pair<const_iterator, const_iterator>
1.529 + equal_range(const key_type& __key) const
1.530 + { return _M_ht.equal_range(__key); }
1.531 +
1.532 + size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
1.533 + void erase(iterator __it) { _M_ht.erase(__it); }
1.534 + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
1.535 + void clear() { _M_ht.clear(); }
1.536 +
1.537 +public:
1.538 + void resize(size_type __hint) { _M_ht.resize(__hint); }
1.539 + size_type bucket_count() const { return _M_ht.bucket_count(); }
1.540 + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
1.541 + size_type elems_in_bucket(size_type __n) const
1.542 + { return _M_ht.elems_in_bucket(__n); }
1.543 + static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
1.544 + return _Ht::_M_equal(__x._M_ht,__y._M_ht);
1.545 + }
1.546 +};
1.547 +
1.548 +#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
1.549 +#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
1.550 +
1.551 +#include <stl/_relops_hash_cont.h>
1.552 +
1.553 +#undef _STLP_TEMPLATE_CONTAINER
1.554 +#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
1.555 +#include <stl/_relops_hash_cont.h>
1.556 +
1.557 +#undef _STLP_TEMPLATE_CONTAINER
1.558 +#undef _STLP_TEMPLATE_HEADER
1.559 +
1.560 +// Specialization of insert_iterator so that it will work for hash_map
1.561 +// and hash_multimap.
1.562 +
1.563 +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
1.564 +
1.565 +template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
1.566 +class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
1.567 +protected:
1.568 + typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
1.569 + _Container* container;
1.570 +public:
1.571 + typedef _Container container_type;
1.572 + typedef output_iterator_tag iterator_category;
1.573 + typedef void value_type;
1.574 + typedef void difference_type;
1.575 + typedef void pointer;
1.576 + typedef void reference;
1.577 +
1.578 + insert_iterator(_Container& __x) : container(&__x) {}
1.579 + insert_iterator(_Container& __x, typename _Container::iterator)
1.580 + : container(&__x) {}
1.581 + insert_iterator<_Container>&
1.582 + operator=(const typename _Container::value_type& __val) {
1.583 + container->insert(__val);
1.584 + return *this;
1.585 + }
1.586 + insert_iterator<_Container>& operator*() { return *this; }
1.587 + insert_iterator<_Container>& operator++() { return *this; }
1.588 + insert_iterator<_Container>& operator++(int) { return *this; }
1.589 +};
1.590 +
1.591 +template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
1.592 +class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
1.593 +protected:
1.594 + typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
1.595 + _Container* container;
1.596 + typename _Container::iterator iter;
1.597 +public:
1.598 + typedef _Container container_type;
1.599 + typedef output_iterator_tag iterator_category;
1.600 + typedef void value_type;
1.601 + typedef void difference_type;
1.602 + typedef void pointer;
1.603 + typedef void reference;
1.604 +
1.605 + insert_iterator(_Container& __x) : container(&__x) {}
1.606 + insert_iterator(_Container& __x, typename _Container::iterator)
1.607 + : container(&__x) {}
1.608 + insert_iterator<_Container>&
1.609 + operator=(const typename _Container::value_type& __val) {
1.610 + container->insert(__val);
1.611 + return *this;
1.612 + }
1.613 + insert_iterator<_Container>& operator*() { return *this; }
1.614 + insert_iterator<_Container>& operator++() { return *this; }
1.615 + insert_iterator<_Container>& operator++(int) { return *this; }
1.616 +};
1.617 +
1.618 +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.619 +
1.620 +// do a cleanup
1.621 +# undef hash_map
1.622 +# undef hash_multimap
1.623 +
1.624 +# define __hash_map__ __FULL_NAME(hash_map)
1.625 +# define __hash_multimap__ __FULL_NAME(hash_multimap)
1.626 +
1.627 +
1.628 +_STLP_END_NAMESPACE
1.629 +
1.630 +# if defined (_STLP_USE_WRAPPER_FOR_ALLOC_PARAM)
1.631 +# include <stl/wrappers/_hash_map.h>
1.632 +# endif /* WRAPPER */
1.633 +
1.634 +#endif /* _STLP_INTERNAL_HASH_MAP_H */
1.635 +
1.636 +// Local Variables:
1.637 +// mode:C++
1.638 +// End:
1.639 +