epoc32/include/stdapis/stlport/stl/_hash_map.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 _hash_map.h
     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: This is an internal header file, included by other STL headers.
       
    27  *   You should not attempt to use it directly.
       
    28  */
       
    29 
       
    30 #ifndef _STLP_INTERNAL_HASH_MAP_H
       
    31 #define _STLP_INTERNAL_HASH_MAP_H
       
    32 
       
    33 #ifndef _STLP_INTERNAL_HASHTABLE_H
       
    34 # include <stl/_hashtable.h>
       
    35 #endif
       
    36 
       
    37 _STLP_BEGIN_NAMESPACE
       
    38 
       
    39 # define  hash_map      __WORKAROUND_RENAME(hash_map)
       
    40 # define  hash_multimap __WORKAROUND_RENAME(hash_multimap)
       
    41 
       
    42 #  define _STLP_KEY_PAIR pair< const _Key, _Tp >
       
    43 #  define _STLP_HASHTABLE hashtable \
       
    44       < pair < const _Key, _Tp >, _Key, _HashFcn, \
       
    45       _STLP_SELECT1ST( _STLP_KEY_PAIR,  _Key ), _EqualKey, _Alloc >
       
    46 
       
    47 template <class _Key, class _Tp, __DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
       
    48           __DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
       
    49           _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
       
    50 class hash_map
       
    51 {
       
    52 private:
       
    53   typedef _STLP_HASHTABLE _Ht;
       
    54   typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
       
    55 public:
       
    56   typedef typename _Ht::key_type key_type;
       
    57   typedef _Tp data_type;
       
    58   typedef _Tp mapped_type;
       
    59   typedef typename _Ht::value_type _value_type;
       
    60   typedef typename _Ht::value_type value_type;
       
    61   typedef typename _Ht::hasher hasher;
       
    62   typedef typename _Ht::key_equal key_equal;
       
    63   
       
    64   typedef typename _Ht::size_type size_type;
       
    65   typedef typename _Ht::difference_type difference_type;
       
    66   typedef typename _Ht::pointer pointer;
       
    67   typedef typename _Ht::const_pointer const_pointer;
       
    68   typedef typename _Ht::reference reference;
       
    69   typedef typename _Ht::const_reference const_reference;
       
    70 
       
    71   typedef typename _Ht::iterator iterator;
       
    72   typedef typename _Ht::const_iterator const_iterator;
       
    73 
       
    74   typedef typename _Ht::allocator_type allocator_type;
       
    75 
       
    76   hasher hash_funct() const { return _M_ht.hash_funct(); }
       
    77   key_equal key_eq() const { return _M_ht.key_eq(); }
       
    78   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
       
    79 
       
    80 private:
       
    81   _Ht _M_ht;
       
    82 public:
       
    83   hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {
       
    84     _STLP_POP_IF_CHECK
       
    85   }
       
    86   explicit hash_map(size_type __n)
       
    87     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {
       
    88     _STLP_POP_IF_CHECK
       
    89   }
       
    90 
       
    91 
       
    92 # ifdef _STLP_USE_TRAP_LEAVE
       
    93   hash_map(const _Self& __o) :
       
    94     _M_ht(__o.size())
       
    95   {
       
    96     _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
    97     _M_ht = __o._M_ht; 
       
    98     _STLP_POP_CLEANUP_ITEM
       
    99   }
       
   100 # else
       
   101   hash_map(const _Self& __o)
       
   102     : _M_ht(__o._M_ht) {
       
   103   }
       
   104 # endif
       
   105 
       
   106   hash_map(size_type __n, const hasher& __hf)
       
   107     : _M_ht(__n, __hf, key_equal(), allocator_type()) {
       
   108     _STLP_POP_IF_CHECK
       
   109   }
       
   110   hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
       
   111            const allocator_type& __a = allocator_type())
       
   112     : _M_ht(__n, __hf, __eql, __a) {
       
   113     _STLP_POP_IF_CHECK
       
   114   }
       
   115 
       
   116 #ifdef _STLP_MEMBER_TEMPLATES
       
   117   template <class _InputIterator>
       
   118   hash_map(_InputIterator __f, _InputIterator __l)
       
   119     : _M_ht(100, hasher(), key_equal(), allocator_type())
       
   120   { 
       
   121     _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   122     _M_ht.insert_unique(__f, __l); 
       
   123     _STLP_POP_CLEANUP_ITEM
       
   124   }
       
   125   template <class _InputIterator>
       
   126   hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
       
   127     : _M_ht(__n, hasher(), key_equal(), allocator_type())
       
   128     { 
       
   129       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   130       _M_ht.insert_unique(__f, __l); 
       
   131       _STLP_POP_CLEANUP_ITEM
       
   132     }
       
   133   template <class _InputIterator>
       
   134   hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
       
   135            const hasher& __hf)
       
   136     : _M_ht(__n, __hf, key_equal(), allocator_type())
       
   137     { 
       
   138       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   139       _M_ht.insert_unique(__f, __l); 
       
   140       _STLP_POP_CLEANUP_ITEM
       
   141     }
       
   142 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
       
   143   template <class _InputIterator>
       
   144   hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
       
   145            const hasher& __hf, const key_equal& __eql)
       
   146     : _M_ht(__n, __hf, __eql, allocator_type())
       
   147     { 
       
   148       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   149       _M_ht.insert_unique(__f, __l); 
       
   150       _STLP_POP_CLEANUP_ITEM
       
   151     }
       
   152 # endif
       
   153   template <class _InputIterator>
       
   154   hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
       
   155            const hasher& __hf, const key_equal& __eql,
       
   156            const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
       
   157     : _M_ht(__n, __hf, __eql, __a)
       
   158     { 
       
   159       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   160       _M_ht.insert_unique(__f, __l); 
       
   161       _STLP_POP_CLEANUP_ITEM
       
   162     }
       
   163 
       
   164 #else
       
   165   hash_map(const value_type* __f, const value_type* __l)
       
   166     : _M_ht(100, hasher(), key_equal(), allocator_type())
       
   167     { 
       
   168       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   169       _M_ht.insert_unique(__f, __l); 
       
   170       _STLP_POP_CLEANUP_ITEM
       
   171     }
       
   172   hash_map(const value_type* __f, const value_type* __l, size_type __n)
       
   173     : _M_ht(__n, hasher(), key_equal(), allocator_type())
       
   174     { 
       
   175       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   176       _M_ht.insert_unique(__f, __l);
       
   177       _STLP_POP_CLEANUP_ITEM
       
   178     }
       
   179   hash_map(const value_type* __f, const value_type* __l, size_type __n,
       
   180            const hasher& __hf)
       
   181     : _M_ht(__n, __hf, key_equal(), allocator_type())
       
   182     { 
       
   183       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   184       _M_ht.insert_unique(__f, __l); 
       
   185       _STLP_POP_CLEANUP_ITEM
       
   186     }
       
   187   hash_map(const value_type* __f, const value_type* __l, size_type __n,
       
   188            const hasher& __hf, const key_equal& __eql,
       
   189            const allocator_type& __a = allocator_type())
       
   190     : _M_ht(__n, __hf, __eql, __a)
       
   191     { 
       
   192       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   193       _M_ht.insert_unique(__f, __l); 
       
   194       _STLP_POP_CLEANUP_ITEM
       
   195     }
       
   196 
       
   197   hash_map(const_iterator __f, const_iterator __l)
       
   198     : _M_ht(100, hasher(), key_equal(), allocator_type())
       
   199     { 
       
   200       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   201       _M_ht.insert_unique(__f, __l); 
       
   202       _STLP_POP_CLEANUP_ITEM
       
   203     }
       
   204   hash_map(const_iterator __f, const_iterator __l, size_type __n)
       
   205     : _M_ht(__n, hasher(), key_equal(), allocator_type())
       
   206     { 
       
   207       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   208       _M_ht.insert_unique(__f, __l); 
       
   209       _STLP_POP_CLEANUP_ITEM
       
   210     }
       
   211   hash_map(const_iterator __f, const_iterator __l, size_type __n,
       
   212            const hasher& __hf)
       
   213     : _M_ht(__n, __hf, key_equal(), allocator_type())
       
   214     { 
       
   215       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   216       _M_ht.insert_unique(__f, __l); 
       
   217       _STLP_POP_CLEANUP_ITEM
       
   218     }
       
   219   hash_map(const_iterator __f, const_iterator __l, size_type __n,
       
   220            const hasher& __hf, const key_equal& __eql,
       
   221            const allocator_type& __a = allocator_type())
       
   222     : _M_ht(__n, __hf, __eql, __a)
       
   223     { 
       
   224       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   225       _M_ht.insert_unique(__f, __l); 
       
   226       _STLP_POP_CLEANUP_ITEM
       
   227     }
       
   228 #endif /*_STLP_MEMBER_TEMPLATES */
       
   229 
       
   230 #ifdef _STLP_USE_TRAP_LEAVE
       
   231 public:
       
   232   static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
       
   233   static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
       
   234 #endif
       
   235 
       
   236 public:
       
   237   size_type size() const { return _M_ht.size(); }
       
   238   size_type max_size() const { return _M_ht.max_size(); }
       
   239   bool empty() const { return _M_ht.empty(); }
       
   240   void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
       
   241   iterator begin() { return _M_ht.begin(); }
       
   242   iterator end() { return _M_ht.end(); }
       
   243   const_iterator begin() const { return _M_ht.begin(); }
       
   244   const_iterator end() const { return _M_ht.end(); }
       
   245 
       
   246 public:
       
   247   pair<iterator,bool> insert(const value_type& __obj)
       
   248     { return _M_ht.insert_unique(__obj); }
       
   249 #ifdef _STLP_MEMBER_TEMPLATES
       
   250   template <class _InputIterator>
       
   251   void insert(_InputIterator __f, _InputIterator __l)
       
   252     { _M_ht.insert_unique(__f,__l); }
       
   253 #else
       
   254   void insert(const value_type* __f, const value_type* __l) {
       
   255     _M_ht.insert_unique(__f,__l);
       
   256   }
       
   257   void insert(const_iterator __f, const_iterator __l)
       
   258     { _M_ht.insert_unique(__f, __l); }
       
   259 #endif /*_STLP_MEMBER_TEMPLATES */
       
   260   pair<iterator,bool> insert_noresize(const value_type& __obj)
       
   261     { return _M_ht.insert_unique_noresize(__obj); }    
       
   262 
       
   263   iterator find(const key_type& __key) { return _M_ht.find(__key); }
       
   264   const_iterator find(const key_type& __key) const { return _M_ht.find(__key); }
       
   265 
       
   266   _Tp& operator[](const key_type& __key) {
       
   267     iterator __it = _M_ht.find(__key);
       
   268     if (__it != _M_ht.end()) {
       
   269       return (*__it).second ;
       
   270     } else {
       
   271       value_type __tmp(__key, __false_type());
       
   272       _STLP_PUSH_STACK_ITEM(value_type, &__tmp)
       
   273       return _M_ht._M_insert(__tmp).second;
       
   274     }
       
   275   }
       
   276 
       
   277   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
       
   278   
       
   279   pair<iterator, iterator> equal_range(const key_type& __key)
       
   280     { return _M_ht.equal_range(__key); }
       
   281   pair<const_iterator, const_iterator>
       
   282   equal_range(const key_type& __key) const
       
   283     { return _M_ht.equal_range(__key); }
       
   284 
       
   285   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
       
   286   void erase(iterator __it) { _M_ht.erase(__it); }
       
   287   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
       
   288   void clear() { _M_ht.clear(); }
       
   289 
       
   290   void resize(size_type __hint) { _M_ht.resize(__hint); }
       
   291   size_type bucket_count() const { return _M_ht.bucket_count(); }
       
   292   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
       
   293   size_type elems_in_bucket(size_type __n) const
       
   294     { return _M_ht.elems_in_bucket(__n); }
       
   295   static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
       
   296     return _Ht::_M_equal(__x._M_ht,__y._M_ht);
       
   297   }
       
   298 };
       
   299 
       
   300 template <class _Key, class _Tp, __DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
       
   301           __DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>),
       
   302           _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(const _Key, _Tp) >
       
   303 class hash_multimap
       
   304 {
       
   305 private:
       
   306   typedef _STLP_HASHTABLE _Ht;
       
   307   typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
       
   308 public:
       
   309   typedef typename _Ht::key_type key_type;
       
   310   typedef _Tp data_type;
       
   311   typedef _Tp mapped_type;
       
   312   typedef typename _Ht::value_type _value_type;
       
   313   typedef _value_type value_type;
       
   314   typedef typename _Ht::hasher hasher;
       
   315   typedef typename _Ht::key_equal key_equal;
       
   316 
       
   317   typedef typename _Ht::size_type size_type;
       
   318   typedef typename _Ht::difference_type difference_type;
       
   319   typedef typename _Ht::pointer pointer;
       
   320   typedef typename _Ht::const_pointer const_pointer;
       
   321   typedef typename _Ht::reference reference;
       
   322   typedef typename _Ht::const_reference const_reference;
       
   323 
       
   324   typedef typename _Ht::iterator iterator;
       
   325   typedef typename _Ht::const_iterator const_iterator;
       
   326 
       
   327   typedef typename _Ht::allocator_type allocator_type;
       
   328 
       
   329   hasher hash_funct() const { return _M_ht.hash_funct(); }
       
   330   key_equal key_eq() const { return _M_ht.key_eq(); }
       
   331   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
       
   332 
       
   333 private:
       
   334   _Ht _M_ht;
       
   335 public:
       
   336   hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {
       
   337     _STLP_POP_IF_CHECK
       
   338   }
       
   339 
       
   340 # ifdef _STLP_USE_TRAP_LEAVE
       
   341   hash_multimap(const _Self& __o) :
       
   342     _M_ht(__o.size())
       
   343   {
       
   344     _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   345     _M_ht = __o._M_ht; 
       
   346     _STLP_POP_CLEANUP_ITEM
       
   347   }
       
   348 # else
       
   349   hash_multimap(const _Self& __o)
       
   350     : _M_ht(__o._M_ht) {
       
   351   }
       
   352 # endif
       
   353 
       
   354   explicit hash_multimap(size_type __n)
       
   355     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {
       
   356     _STLP_POP_IF_CHECK
       
   357   }
       
   358   hash_multimap(size_type __n, const hasher& __hf)
       
   359     : _M_ht(__n, __hf, key_equal(), allocator_type()) {
       
   360     _STLP_POP_IF_CHECK
       
   361   }
       
   362   hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
       
   363                 const allocator_type& __a = allocator_type())
       
   364     : _M_ht(__n, __hf, __eql, __a) {
       
   365     _STLP_POP_IF_CHECK
       
   366   }
       
   367 
       
   368 #ifdef _STLP_MEMBER_TEMPLATES
       
   369   template <class _InputIterator>
       
   370   hash_multimap(_InputIterator __f, _InputIterator __l)
       
   371     : _M_ht(100, hasher(), key_equal(), allocator_type())
       
   372   { 
       
   373     _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   374       _M_ht.insert_equal(__f, __l); 
       
   375     _STLP_POP_CLEANUP_ITEM
       
   376   }
       
   377   template <class _InputIterator>
       
   378   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
       
   379     : _M_ht(__n, hasher(), key_equal(), allocator_type())
       
   380     {
       
   381       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   382       _M_ht.insert_equal(__f, __l); 
       
   383       _STLP_POP_CLEANUP_ITEM
       
   384     }
       
   385   template <class _InputIterator>
       
   386   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
       
   387                 const hasher& __hf)
       
   388     : _M_ht(__n, __hf, key_equal(), allocator_type())
       
   389     { 
       
   390       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   391       _M_ht.insert_equal(__f, __l); 
       
   392       _STLP_POP_CLEANUP_ITEM
       
   393     }
       
   394 # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
       
   395   template <class _InputIterator>
       
   396   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
       
   397                 const hasher& __hf, const key_equal& __eql)
       
   398     : _M_ht(__n, __hf, __eql, allocator_type())
       
   399     { 
       
   400       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   401       _M_ht.insert_equal(__f, __l); 
       
   402       _STLP_POP_CLEANUP_ITEM
       
   403     }
       
   404 #  endif
       
   405   template <class _InputIterator>
       
   406   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
       
   407                 const hasher& __hf, const key_equal& __eql,
       
   408                 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
       
   409     : _M_ht(__n, __hf, __eql, __a)
       
   410     { 
       
   411       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   412       _M_ht.insert_equal(__f, __l); 
       
   413       _STLP_POP_CLEANUP_ITEM
       
   414     }
       
   415 
       
   416 #else
       
   417   hash_multimap(const value_type* __f, const value_type* __l)
       
   418     : _M_ht(100, hasher(), key_equal(), allocator_type())
       
   419     { 
       
   420       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   421       _M_ht.insert_equal(__f, __l); 
       
   422       _STLP_POP_CLEANUP_ITEM
       
   423     }
       
   424   hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
       
   425     : _M_ht(__n, hasher(), key_equal(), allocator_type())
       
   426     { 
       
   427       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   428       _M_ht.insert_equal(__f, __l); 
       
   429       _STLP_POP_CLEANUP_ITEM
       
   430     }
       
   431   hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
       
   432                 const hasher& __hf)
       
   433     : _M_ht(__n, __hf, key_equal(), allocator_type())
       
   434     { 
       
   435       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   436       _M_ht.insert_equal(__f, __l); 
       
   437       _STLP_POP_CLEANUP_ITEM
       
   438     }
       
   439   hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
       
   440                 const hasher& __hf, const key_equal& __eql,
       
   441                 const allocator_type& __a = allocator_type())
       
   442     : _M_ht(__n, __hf, __eql, __a)
       
   443     { 
       
   444       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   445       _M_ht.insert_equal(__f, __l); 
       
   446       _STLP_POP_CLEANUP_ITEM
       
   447     }
       
   448 
       
   449   hash_multimap(const_iterator __f, const_iterator __l)
       
   450     : _M_ht(100, hasher(), key_equal(), allocator_type())
       
   451     { 
       
   452       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   453       _M_ht.insert_equal(__f, __l); 
       
   454       _STLP_POP_CLEANUP_ITEM
       
   455     }
       
   456   hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
       
   457     : _M_ht(__n, hasher(), key_equal(), allocator_type())
       
   458     { 
       
   459       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   460       _M_ht.insert_equal(__f, __l); 
       
   461       _STLP_POP_CLEANUP_ITEM
       
   462     }
       
   463   hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
       
   464                 const hasher& __hf)
       
   465     : _M_ht(__n, __hf, key_equal(), allocator_type())
       
   466     { 
       
   467       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   468       _M_ht.insert_equal(__f, __l); 
       
   469       _STLP_POP_CLEANUP_ITEM
       
   470     }
       
   471   hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
       
   472                 const hasher& __hf, const key_equal& __eql,
       
   473                 const allocator_type& __a = allocator_type())
       
   474     : _M_ht(__n, __hf, __eql, __a)
       
   475     { 
       
   476       _STLP_PUSH_CLEANUP_ITEM(_Self, this)
       
   477       _M_ht.insert_equal(__f, __l); 
       
   478       _STLP_POP_CLEANUP_ITEM
       
   479     }
       
   480 #endif /*_STLP_MEMBER_TEMPLATES */
       
   481 
       
   482 #ifdef _STLP_USE_TRAP_LEAVE
       
   483 public:
       
   484   static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
       
   485   static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
       
   486 #endif
       
   487 
       
   488 public:
       
   489   size_type size() const { return _M_ht.size(); }
       
   490   size_type max_size() const { return _M_ht.max_size(); }
       
   491   bool empty() const { return _M_ht.empty(); }
       
   492   void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
       
   493 
       
   494   iterator begin() { return _M_ht.begin(); }
       
   495   iterator end() { return _M_ht.end(); }
       
   496   const_iterator begin() const { return _M_ht.begin(); }
       
   497   const_iterator end() const { return _M_ht.end(); }
       
   498 
       
   499 public:
       
   500   iterator insert(const value_type& __obj) 
       
   501     { return _M_ht.insert_equal(__obj); }
       
   502 #ifdef _STLP_MEMBER_TEMPLATES
       
   503   template <class _InputIterator>
       
   504   void insert(_InputIterator __f, _InputIterator __l) 
       
   505     { _M_ht.insert_equal(__f,__l); }
       
   506 #else
       
   507   void insert(const value_type* __f, const value_type* __l) {
       
   508     _M_ht.insert_equal(__f,__l);
       
   509   }
       
   510   void insert(const_iterator __f, const_iterator __l) 
       
   511     { _M_ht.insert_equal(__f, __l); }
       
   512 #endif /*_STLP_MEMBER_TEMPLATES */
       
   513   iterator insert_noresize(const value_type& __obj)
       
   514     { return _M_ht.insert_equal_noresize(__obj); }    
       
   515 
       
   516   iterator find(const key_type& __key) { return _M_ht.find(__key); }
       
   517   const_iterator find(const key_type& __key) const 
       
   518     { return _M_ht.find(__key); }
       
   519 
       
   520   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
       
   521   
       
   522   pair<iterator, iterator> equal_range(const key_type& __key)
       
   523     { return _M_ht.equal_range(__key); }
       
   524   pair<const_iterator, const_iterator>
       
   525   equal_range(const key_type& __key) const
       
   526     { return _M_ht.equal_range(__key); }
       
   527 
       
   528   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
       
   529   void erase(iterator __it) { _M_ht.erase(__it); }
       
   530   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
       
   531   void clear() { _M_ht.clear(); }
       
   532 
       
   533 public:
       
   534   void resize(size_type __hint) { _M_ht.resize(__hint); }
       
   535   size_type bucket_count() const { return _M_ht.bucket_count(); }
       
   536   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
       
   537   size_type elems_in_bucket(size_type __n) const
       
   538     { return _M_ht.elems_in_bucket(__n); }
       
   539   static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
       
   540     return _Ht::_M_equal(__x._M_ht,__y._M_ht);
       
   541   }
       
   542 };
       
   543 
       
   544 #define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
       
   545 #define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
       
   546 
       
   547 #include <stl/_relops_hash_cont.h>
       
   548 
       
   549 #undef _STLP_TEMPLATE_CONTAINER
       
   550 #define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
       
   551 #include <stl/_relops_hash_cont.h>
       
   552 
       
   553 #undef _STLP_TEMPLATE_CONTAINER
       
   554 #undef _STLP_TEMPLATE_HEADER
       
   555 
       
   556 // Specialization of insert_iterator so that it will work for hash_map
       
   557 // and hash_multimap.
       
   558 
       
   559 #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
       
   560 
       
   561 template <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
       
   562 class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
       
   563 protected:
       
   564   typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
       
   565   _Container* container;
       
   566 public:
       
   567   typedef _Container          container_type;
       
   568   typedef output_iterator_tag iterator_category;
       
   569   typedef void                value_type;
       
   570   typedef void                difference_type;
       
   571   typedef void                pointer;
       
   572   typedef void                reference;
       
   573 
       
   574   insert_iterator(_Container& __x) : container(&__x) {}
       
   575   insert_iterator(_Container& __x, typename _Container::iterator)
       
   576     : container(&__x) {}
       
   577   insert_iterator<_Container>&
       
   578   operator=(const typename _Container::value_type& __val) { 
       
   579     container->insert(__val);
       
   580     return *this;
       
   581   }
       
   582   insert_iterator<_Container>& operator*() { return *this; }
       
   583   insert_iterator<_Container>& operator++() { return *this; }
       
   584   insert_iterator<_Container>& operator++(int) { return *this; }
       
   585 };
       
   586 
       
   587 template <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
       
   588 class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
       
   589 protected:
       
   590   typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
       
   591   _Container* container;
       
   592   typename _Container::iterator iter;
       
   593 public:
       
   594   typedef _Container          container_type;
       
   595   typedef output_iterator_tag iterator_category;
       
   596   typedef void                value_type;
       
   597   typedef void                difference_type;
       
   598   typedef void                pointer;
       
   599   typedef void                reference;
       
   600 
       
   601   insert_iterator(_Container& __x) : container(&__x) {}
       
   602   insert_iterator(_Container& __x, typename _Container::iterator)
       
   603     : container(&__x) {}
       
   604   insert_iterator<_Container>&
       
   605   operator=(const typename _Container::value_type& __val) { 
       
   606     container->insert(__val);
       
   607     return *this;
       
   608   }
       
   609   insert_iterator<_Container>& operator*() { return *this; }
       
   610   insert_iterator<_Container>& operator++() { return *this; }
       
   611   insert_iterator<_Container>& operator++(int) { return *this; }
       
   612 };
       
   613 
       
   614 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
       
   615 
       
   616 // do a cleanup
       
   617 # undef hash_map
       
   618 # undef hash_multimap
       
   619 
       
   620 # define __hash_map__ __FULL_NAME(hash_map)
       
   621 # define __hash_multimap__ __FULL_NAME(hash_multimap)
       
   622 
       
   623 
       
   624 _STLP_END_NAMESPACE
       
   625 
       
   626 # if defined (_STLP_USE_WRAPPER_FOR_ALLOC_PARAM) 
       
   627 #  include <stl/wrappers/_hash_map.h>
       
   628 # endif /*  WRAPPER */
       
   629 
       
   630 #endif /* _STLP_INTERNAL_HASH_MAP_H */
       
   631 
       
   632 // Local Variables:
       
   633 // mode:C++
       
   634 // End:
       
   635