57 #ifndef _BACKWARD_HASH_MAP
58 #define _BACKWARD_HASH_MAP 1
60 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
68 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_VERSION
75 using std::_Select1st;
82 template<
class _Key,
class _Tp,
class _HashFn = hash<_Key>,
83 class _EqualKey = equal_to<_Key>,
class _Alloc = allocator<_Tp> >
87 typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,
88 _Select1st<pair<const _Key, _Tp> >,
89 _EqualKey, _Alloc> _Ht;
94 typedef typename _Ht::key_type key_type;
95 typedef _Tp data_type;
96 typedef _Tp mapped_type;
98 typedef typename _Ht::hasher hasher;
99 typedef typename _Ht::key_equal key_equal;
101 typedef typename _Ht::size_type size_type;
102 typedef typename _Ht::difference_type difference_type;
108 typedef typename _Ht::iterator iterator;
109 typedef typename _Ht::const_iterator const_iterator;
111 typedef typename _Ht::allocator_type allocator_type;
115 {
return _M_ht.hash_funct(); }
119 {
return _M_ht.key_eq(); }
122 get_allocator()
const
123 {
return _M_ht.get_allocator(); }
126 : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
130 : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
132 hash_map(size_type __n,
const hasher& __hf)
133 : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
135 hash_map(size_type __n,
const hasher& __hf,
const key_equal& __eql,
136 const allocator_type& __a = allocator_type())
137 : _M_ht(__n, __hf, __eql, __a) {}
139 template<
class _InputIterator>
140 hash_map(_InputIterator __f, _InputIterator __l)
141 : _M_ht(100, hasher(), key_equal(), allocator_type())
142 { _M_ht.insert_unique(__f, __l); }
144 template<
class _InputIterator>
145 hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
146 : _M_ht(__n, hasher(), key_equal(), allocator_type())
147 { _M_ht.insert_unique(__f, __l); }
149 template<
class _InputIterator>
150 hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
152 : _M_ht(__n, __hf, key_equal(), allocator_type())
153 { _M_ht.insert_unique(__f, __l); }
155 template<
class _InputIterator>
156 hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
157 const hasher& __hf,
const key_equal& __eql,
158 const allocator_type& __a = allocator_type())
159 : _M_ht(__n, __hf, __eql, __a)
160 { _M_ht.insert_unique(__f, __l); }
164 {
return _M_ht.size(); }
168 {
return _M_ht.max_size(); }
172 {
return _M_ht.empty(); }
176 { _M_ht.swap(__hs._M_ht); }
178 template<
class _K1,
class _T1,
class _HF,
class _EqK,
class _Al>
185 {
return _M_ht.begin(); }
189 {
return _M_ht.end(); }
193 {
return _M_ht.begin(); }
197 {
return _M_ht.end(); }
201 {
return _M_ht.insert_unique(__obj); }
203 template<
class _InputIterator>
205 insert(_InputIterator __f, _InputIterator __l)
206 { _M_ht.insert_unique(__f, __l); }
210 {
return _M_ht.insert_unique_noresize(__obj); }
213 find(
const key_type& __key)
214 {
return _M_ht.find(__key); }
217 find(
const key_type& __key)
const
218 {
return _M_ht.find(__key); }
221 operator[](
const key_type& __key)
222 {
return _M_ht.find_or_insert(
value_type(__key, _Tp())).second; }
225 count(
const key_type& __key)
const
226 {
return _M_ht.count(__key); }
229 equal_range(
const key_type& __key)
230 {
return _M_ht.equal_range(__key); }
233 equal_range(
const key_type& __key)
const
234 {
return _M_ht.equal_range(__key); }
237 erase(
const key_type& __key)
238 {
return _M_ht.erase(__key); }
242 { _M_ht.erase(__it); }
245 erase(iterator __f, iterator __l)
246 { _M_ht.erase(__f, __l); }
253 resize(size_type __hint)
254 { _M_ht.resize(__hint); }
258 {
return _M_ht.bucket_count(); }
261 max_bucket_count()
const
262 {
return _M_ht.max_bucket_count(); }
265 elems_in_bucket(size_type __n)
const
266 {
return _M_ht.elems_in_bucket(__n); }
269 template<
class _Key,
class _Tp,
class _HashFn,
class _EqlKey,
class _Alloc>
273 {
return __hm1._M_ht == __hm2._M_ht; }
275 template<
class _Key,
class _Tp,
class _HashFn,
class _EqlKey,
class _Alloc>
277 operator!=(
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
278 const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
279 {
return !(__hm1 == __hm2); }
281 template<
class _Key,
class _Tp,
class _HashFn,
class _EqlKey,
class _Alloc>
283 swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
284 hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
285 { __hm1.swap(__hm2); }
293 template<
class _Key,
class _Tp,
294 class _HashFn = hash<_Key>,
295 class _EqualKey = equal_to<_Key>,
296 class _Alloc = allocator<_Tp> >
300 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
301 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
302 __glibcxx_class_requires3(_HashFn,
size_t, _Key, _UnaryFunctionConcept)
303 __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)
306 typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,
307 _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
313 typedef typename _Ht::key_type key_type;
314 typedef _Tp data_type;
315 typedef _Tp mapped_type;
317 typedef typename _Ht::hasher hasher;
318 typedef typename _Ht::key_equal key_equal;
320 typedef typename _Ht::size_type size_type;
321 typedef typename _Ht::difference_type difference_type;
327 typedef typename _Ht::iterator iterator;
328 typedef typename _Ht::const_iterator const_iterator;
330 typedef typename _Ht::allocator_type allocator_type;
334 {
return _M_ht.hash_funct(); }
338 {
return _M_ht.key_eq(); }
341 get_allocator()
const
342 {
return _M_ht.get_allocator(); }
345 : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
349 : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
352 : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
354 hash_multimap(size_type __n,
const hasher& __hf,
const key_equal& __eql,
355 const allocator_type& __a = allocator_type())
356 : _M_ht(__n, __hf, __eql, __a) {}
358 template<
class _InputIterator>
360 : _M_ht(100, hasher(), key_equal(), allocator_type())
361 { _M_ht.insert_equal(__f, __l); }
363 template<
class _InputIterator>
364 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
365 : _M_ht(__n, hasher(), key_equal(), allocator_type())
366 { _M_ht.insert_equal(__f, __l); }
368 template<
class _InputIterator>
369 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
371 : _M_ht(__n, __hf, key_equal(), allocator_type())
372 { _M_ht.insert_equal(__f, __l); }
374 template<
class _InputIterator>
375 hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
376 const hasher& __hf,
const key_equal& __eql,
377 const allocator_type& __a = allocator_type())
378 : _M_ht(__n, __hf, __eql, __a)
379 { _M_ht.insert_equal(__f, __l); }
383 {
return _M_ht.size(); }
387 {
return _M_ht.max_size(); }
391 {
return _M_ht.empty(); }
395 { _M_ht.swap(__hs._M_ht); }
397 template<
class _K1,
class _T1,
class _HF,
class _EqK,
class _Al>
404 {
return _M_ht.begin(); }
408 {
return _M_ht.end(); }
412 {
return _M_ht.begin(); }
416 {
return _M_ht.end(); }
420 {
return _M_ht.insert_equal(__obj); }
422 template<
class _InputIterator>
424 insert(_InputIterator __f, _InputIterator __l)
425 { _M_ht.insert_equal(__f,__l); }
429 {
return _M_ht.insert_equal_noresize(__obj); }
432 find(
const key_type& __key)
433 {
return _M_ht.find(__key); }
436 find(
const key_type& __key)
const
437 {
return _M_ht.find(__key); }
440 count(
const key_type& __key)
const
441 {
return _M_ht.count(__key); }
444 equal_range(
const key_type& __key)
445 {
return _M_ht.equal_range(__key); }
448 equal_range(
const key_type& __key)
const
449 {
return _M_ht.equal_range(__key); }
452 erase(
const key_type& __key)
453 {
return _M_ht.erase(__key); }
457 { _M_ht.erase(__it); }
460 erase(iterator __f, iterator __l)
461 { _M_ht.erase(__f, __l); }
468 resize(size_type __hint)
469 { _M_ht.resize(__hint); }
473 {
return _M_ht.bucket_count(); }
476 max_bucket_count()
const
477 {
return _M_ht.max_bucket_count(); }
480 elems_in_bucket(size_type __n)
const
481 {
return _M_ht.elems_in_bucket(__n); }
484 template<
class _Key,
class _Tp,
class _HF,
class _EqKey,
class _Alloc>
488 {
return __hm1._M_ht == __hm2._M_ht; }
490 template<
class _Key,
class _Tp,
class _HF,
class _EqKey,
class _Alloc>
492 operator!=(
const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
493 const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
494 {
return !(__hm1 == __hm2); }
496 template<
class _Key,
class _Tp,
class _HashFn,
class _EqlKey,
class _Alloc>
498 swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
499 hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
500 { __hm1.swap(__hm2); }
502 _GLIBCXX_END_NAMESPACE_VERSION
505 namespace std _GLIBCXX_VISIBILITY(default)
507 _GLIBCXX_BEGIN_NAMESPACE_VERSION
511 template<
class _Key,
class _Tp,
class _HashFn,
class _EqKey,
class _Alloc>
512 class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn,
518 _Container* container;
534 insert_iterator<_Container>&
535 operator=(
const typename _Container::value_type& __value)
537 container->insert(__value);
541 insert_iterator<_Container>&
545 insert_iterator<_Container>&
548 insert_iterator<_Container>&
553 template<
class _Key,
class _Tp,
class _HashFn,
class _EqKey,
class _Alloc>
554 class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,
560 _Container* container;
561 typename _Container::iterator iter;
577 insert_iterator<_Container>&
578 operator=(
const typename _Container::value_type& __value)
580 container->insert(__value);
584 insert_iterator<_Container>&
588 insert_iterator<_Container>&
592 insert_iterator<_Container>&
597 _GLIBCXX_END_NAMESPACE_VERSION
Struct holding two objects of arbitrary type.
insert_iterator & operator*()
Simply returns *this.
insert_iterator(_Container &__x, typename _Container::iterator __i)
insert_iterator & operator=(const typename _Container::value_type &__value)
One of the comparison functors.
void difference_type
Distance between iterators is represented as this type.
void pointer
This type represents a pointer-to-value_type.
_Container container_type
A nested typedef for the type of whatever container you used.
insert_iterator & operator++()
Simply returns *this. (This iterator does not move.)
void value_type
The type "pointed to" by the iterator.
output_iterator_tag iterator_category
One of the tag types.
void reference
This type represents a reference-to-value_type.
The standard allocator, as per [20.4].Further details: http://gcc.gnu.org/onlinedocs/libstdc++/manual...