56 #ifndef _BACKWARD_HASH_MAP 
   57 #define _BACKWARD_HASH_MAP 1 
   59 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH 
   67 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 
   69 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   74   using std::_Select1st;
 
   81   template<
class _Key, 
class _Tp, 
class _HashFn = hash<_Key>,
 
   82        class _EqualKey = equal_to<_Key>, 
class _Alloc = allocator<_Tp> >
 
   86       typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,
 
   87             _Select1st<pair<const _Key, _Tp> >,
 
   88             _EqualKey, _Alloc> _Ht;
 
   93       typedef typename _Ht::key_type key_type;
 
   94       typedef _Tp data_type;
 
   95       typedef _Tp mapped_type;
 
   97       typedef typename _Ht::hasher hasher;
 
   98       typedef typename _Ht::key_equal key_equal;
 
  100       typedef typename _Ht::size_type size_type;
 
  101       typedef typename _Ht::difference_type difference_type;
 
  107       typedef typename _Ht::iterator iterator;
 
  108       typedef typename _Ht::const_iterator const_iterator;
 
  110       typedef typename _Ht::allocator_type allocator_type;
 
  114       { 
return _M_ht.hash_funct(); }
 
  118       { 
return _M_ht.key_eq(); }
 
  121       get_allocator()
 const 
  122       { 
return _M_ht.get_allocator(); }
 
  125       : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
 
  129       : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
 
  131       hash_map(size_type __n, 
const hasher& __hf)
 
  132       : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
 
  134       hash_map(size_type __n, 
const hasher& __hf, 
const key_equal& __eql,
 
  135            const allocator_type& __a = allocator_type())
 
  136       : _M_ht(__n, __hf, __eql, __a) {}
 
  138       template<
class _InputIterator>
 
  139         hash_map(_InputIterator __f, _InputIterator __l)
 
  140     : _M_ht(100, hasher(), key_equal(), allocator_type())
 
  141         { _M_ht.insert_unique(__f, __l); }
 
  143       template<
class _InputIterator>
 
  144         hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
 
  145     : _M_ht(__n, hasher(), key_equal(), allocator_type())
 
  146         { _M_ht.insert_unique(__f, __l); }
 
  148       template<
class _InputIterator>
 
  149         hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
 
  151     : _M_ht(__n, __hf, key_equal(), allocator_type())
 
  152         { _M_ht.insert_unique(__f, __l); }
 
  154       template<
class _InputIterator>
 
  155         hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
 
  156          const hasher& __hf, 
const key_equal& __eql,
 
  157          const allocator_type& __a = allocator_type())
 
  158     : _M_ht(__n, __hf, __eql, __a)
 
  159         { _M_ht.insert_unique(__f, __l); }
 
  163       { 
return _M_ht.size(); }
 
  167       { 
return _M_ht.max_size(); }
 
  171       { 
return _M_ht.empty(); }
 
  175       { _M_ht.swap(__hs._M_ht); }
 
  177       template<
class _K1, 
class _T1, 
class _HF, 
class _EqK, 
class _Al>
 
  184       { 
return _M_ht.begin(); }
 
  188       { 
return _M_ht.end(); }
 
  192       { 
return _M_ht.begin(); }
 
  196       { 
return _M_ht.end(); }
 
  200       { 
return _M_ht.insert_unique(__obj); }
 
  202       template<
class _InputIterator>
 
  204         insert(_InputIterator __f, _InputIterator __l)
 
  205         { _M_ht.insert_unique(__f, __l); }
 
  209       { 
return _M_ht.insert_unique_noresize(__obj); }
 
  212       find(
const key_type& __key)
 
  213       { 
return _M_ht.find(__key); }
 
  216       find(
const key_type& __key)
 const 
  217       { 
return _M_ht.find(__key); }
 
  220       operator[](
const key_type& __key)
 
  221       { 
return _M_ht.find_or_insert(
value_type(__key, _Tp())).second; }
 
  224       count(
const key_type& __key)
 const 
  225       { 
return _M_ht.count(__key); }
 
  228       equal_range(
const key_type& __key)
 
  229       { 
return _M_ht.equal_range(__key); }
 
  232       equal_range(
const key_type& __key)
 const 
  233       { 
return _M_ht.equal_range(__key); }
 
  236       erase(
const key_type& __key)
 
  237       {
return _M_ht.erase(__key); }
 
  241       { _M_ht.erase(__it); }
 
  244       erase(iterator __f, iterator __l)
 
  245       { _M_ht.erase(__f, __l); }
 
  252       resize(size_type __hint)
 
  253       { _M_ht.resize(__hint); }
 
  257       { 
return _M_ht.bucket_count(); }
 
  260       max_bucket_count()
 const 
  261       { 
return _M_ht.max_bucket_count(); }
 
  264       elems_in_bucket(size_type __n)
 const 
  265       { 
return _M_ht.elems_in_bucket(__n); }
 
  268   template<
class _Key, 
class _Tp, 
class _HashFn, 
class _EqlKey, 
class _Alloc>
 
  272     { 
return __hm1._M_ht == __hm2._M_ht; }
 
  274   template<
class _Key, 
class _Tp, 
class _HashFn, 
class _EqlKey, 
class _Alloc>
 
  276     operator!=(
const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
 
  277            const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
 
  278     { 
return !(__hm1 == __hm2); }
 
  280   template<
class _Key, 
class _Tp, 
class _HashFn, 
class _EqlKey, 
class _Alloc>
 
  282     swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
 
  283      hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
 
  284     { __hm1.swap(__hm2); }
 
  292   template<
class _Key, 
class _Tp,
 
  293        class _HashFn = hash<_Key>,
 
  294        class _EqualKey = equal_to<_Key>,
 
  295        class _Alloc = allocator<_Tp> >
 
  299       __glibcxx_class_requires(_Key, _SGIAssignableConcept)
 
  300       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
 
  301       __glibcxx_class_requires3(_HashFn, 
size_t, _Key, _UnaryFunctionConcept)
 
  302       __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)
 
  305       typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,
 
  306             _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
 
  312       typedef typename _Ht::key_type key_type;
 
  313       typedef _Tp data_type;
 
  314       typedef _Tp mapped_type;
 
  316       typedef typename _Ht::hasher hasher;
 
  317       typedef typename _Ht::key_equal key_equal;
 
  319       typedef typename _Ht::size_type size_type;
 
  320       typedef typename _Ht::difference_type difference_type;
 
  326       typedef typename _Ht::iterator iterator;
 
  327       typedef typename _Ht::const_iterator const_iterator;
 
  329       typedef typename _Ht::allocator_type allocator_type;
 
  333       { 
return _M_ht.hash_funct(); }
 
  337       { 
return _M_ht.key_eq(); }
 
  340       get_allocator()
 const 
  341       { 
return _M_ht.get_allocator(); }
 
  344       : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
 
  348       : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
 
  351       : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
 
  353       hash_multimap(size_type __n, 
const hasher& __hf, 
const key_equal& __eql,
 
  354             const allocator_type& __a = allocator_type())
 
  355       : _M_ht(__n, __hf, __eql, __a) {}
 
  357       template<
class _InputIterator>
 
  359     : _M_ht(100, hasher(), key_equal(), allocator_type())
 
  360         { _M_ht.insert_equal(__f, __l); }
 
  362       template<
class _InputIterator>
 
  363         hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
 
  364     : _M_ht(__n, hasher(), key_equal(), allocator_type())
 
  365         { _M_ht.insert_equal(__f, __l); }
 
  367       template<
class _InputIterator>
 
  368         hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
 
  370     : _M_ht(__n, __hf, key_equal(), allocator_type())
 
  371         { _M_ht.insert_equal(__f, __l); }
 
  373       template<
class _InputIterator>
 
  374         hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
 
  375               const hasher& __hf, 
const key_equal& __eql,
 
  376               const allocator_type& __a = allocator_type())
 
  377     : _M_ht(__n, __hf, __eql, __a)
 
  378         { _M_ht.insert_equal(__f, __l); }
 
  382       { 
return _M_ht.size(); }
 
  386       { 
return _M_ht.max_size(); }
 
  390       { 
return _M_ht.empty(); }
 
  394       { _M_ht.swap(__hs._M_ht); }
 
  396       template<
class _K1, 
class _T1, 
class _HF, 
class _EqK, 
class _Al>
 
  403       { 
return _M_ht.begin(); }
 
  407       { 
return _M_ht.end(); }
 
  411       { 
return _M_ht.begin(); }
 
  415       { 
return _M_ht.end(); }
 
  419       { 
return _M_ht.insert_equal(__obj); }
 
  421       template<
class _InputIterator>
 
  423         insert(_InputIterator __f, _InputIterator __l)
 
  424         { _M_ht.insert_equal(__f,__l); }
 
  428       { 
return _M_ht.insert_equal_noresize(__obj); }
 
  431       find(
const key_type& __key)
 
  432       { 
return _M_ht.find(__key); }
 
  435       find(
const key_type& __key)
 const 
  436       { 
return _M_ht.find(__key); }
 
  439       count(
const key_type& __key)
 const 
  440       { 
return _M_ht.count(__key); }
 
  443       equal_range(
const key_type& __key)
 
  444       { 
return _M_ht.equal_range(__key); }
 
  447       equal_range(
const key_type& __key)
 const 
  448       { 
return _M_ht.equal_range(__key); }
 
  451       erase(
const key_type& __key)
 
  452       { 
return _M_ht.erase(__key); }
 
  456       { _M_ht.erase(__it); }
 
  459       erase(iterator __f, iterator __l)
 
  460       { _M_ht.erase(__f, __l); }
 
  467       resize(size_type __hint)
 
  468       { _M_ht.resize(__hint); }
 
  472       { 
return _M_ht.bucket_count(); }
 
  475       max_bucket_count()
 const 
  476       { 
return _M_ht.max_bucket_count(); }
 
  479       elems_in_bucket(size_type __n)
 const 
  480       { 
return _M_ht.elems_in_bucket(__n); }
 
  483   template<
class _Key, 
class _Tp, 
class _HF, 
class _EqKey, 
class _Alloc>
 
  487     { 
return __hm1._M_ht == __hm2._M_ht; }
 
  489   template<
class _Key, 
class _Tp, 
class _HF, 
class _EqKey, 
class _Alloc>
 
  491     operator!=(
const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
 
  492            const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
 
  493     { 
return !(__hm1 == __hm2); }
 
  495   template<
class _Key, 
class _Tp, 
class _HashFn, 
class _EqlKey, 
class _Alloc>
 
  497     swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
 
  498      hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
 
  499     { __hm1.swap(__hm2); }
 
  501 _GLIBCXX_END_NAMESPACE_VERSION
 
  504 namespace std _GLIBCXX_VISIBILITY(default)
 
  506 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
  510   template<
class _Key, 
class _Tp, 
class _HashFn,  
class _EqKey, 
class _Alloc>
 
  511     class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn, 
 
  517       _Container* container;
 
  533       insert_iterator<_Container>&
 
  534       operator=(
const typename _Container::value_type& __value)
 
  536     container->insert(__value);
 
  540       insert_iterator<_Container>&
 
  544       insert_iterator<_Container>&
 
  547       insert_iterator<_Container>&
 
  552   template<
class _Key, 
class _Tp, 
class _HashFn,  
class _EqKey, 
class _Alloc>
 
  553     class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,
 
  559       _Container* container;
 
  560       typename _Container::iterator iter;
 
  576       insert_iterator<_Container>&
 
  577       operator=(
const typename _Container::value_type& __value)
 
  579     container->insert(__value);
 
  583       insert_iterator<_Container>&
 
  587       insert_iterator<_Container>&
 
  591       insert_iterator<_Container>&
 
  596 _GLIBCXX_END_NAMESPACE_VERSION
 
output_iterator_tag iterator_category
One of the tag types. 
 
Struct holding two objects of arbitrary type. 
 
void reference
This type represents a reference-to-value_type. 
 
insert_iterator & operator=(const typename _Container::value_type &__value)
 
_Container container_type
A nested typedef for the type of whatever container you used. 
 
insert_iterator & operator*()
Simply returns *this. 
 
void value_type
The type "pointed to" by the iterator. 
 
insert_iterator & operator++()
Simply returns *this. (This iterator does not move.) 
 
The standard allocator, as per [20.4]. 
 
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers. 
 
One of the comparison functors. 
 
void pointer
This type represents a pointer-to-value_type. 
 
void difference_type
Distance between iterators is represented as this type. 
 
insert_iterator(_Container &__x, typename _Container::iterator __i)