stl_hash_map.h

00001 /*
00002  * Copyright (c) 1996
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Permission to use, copy, modify, distribute and sell this software
00006  * and its documentation for any purpose is hereby granted without fee,
00007  * provided that the above copyright notice appear in all copies and
00008  * that both that copyright notice and this permission notice appear
00009  * in supporting documentation.  Silicon Graphics makes no
00010  * representations about the suitability of this software for any
00011  * purpose.  It is provided "as is" without express or implied warranty.
00012  *
00013  *
00014  * Copyright (c) 1994
00015  * Hewlett-Packard Company
00016  *
00017  * Permission to use, copy, modify, distribute and sell this software
00018  * and its documentation for any purpose is hereby granted without fee,
00019  * provided that the above copyright notice appear in all copies and
00020  * that both that copyright notice and this permission notice appear
00021  * in supporting documentation.  Hewlett-Packard Company makes no
00022  * representations about the suitability of this software for any
00023  * purpose.  It is provided "as is" without express or implied warranty.
00024  *
00025  */
00026 
00027 /* NOTE: This is an internal header file, included by other STL headers.
00028  *   You should not attempt to use it directly.
00029  */
00030 
00031 #ifndef __SGI_STL_INTERNAL_HASH_MAP_H
00032 #define __SGI_STL_INTERNAL_HASH_MAP_H
00033 
00034 #include <concept_checks.h>
00035 
00036 __STL_BEGIN_NAMESPACE
00037 
00038 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00039 #pragma set woff 1174
00040 #pragma set woff 1375
00041 #endif
00042 
00043 // Forward declaration of equality operator; needed for friend declaration.
00044 
00045 template <class _Key, class _Tp,
00046           class _HashFcn  __STL_DEPENDENT_DEFAULT_TMPL(hash<_Key>),
00047           class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Key>),
00048           class _Alloc =  __STL_DEFAULT_ALLOCATOR(_Tp) >
00049 class hash_map;
00050 
00051 template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
00052 inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&,
00053                        const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&);
00054 
00055 template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
00056           class _Alloc>
00057 class hash_map
00058 {
00059   // requirements:
00060 
00061   __STL_CLASS_REQUIRES(_Key, _Assignable);
00062   __STL_CLASS_REQUIRES(_Tp, _Assignable);
00063   __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key);
00064   __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key);
00065 
00066 private:
00067   typedef hashtable<pair<const _Key,_Tp>,_Key,_HashFcn,
00068                     _Select1st<pair<const _Key,_Tp> >,_EqualKey,_Alloc> _Ht;
00069   _Ht _M_ht;
00070 
00071 public:
00072   typedef typename _Ht::key_type key_type;
00073   typedef _Tp data_type;
00074   typedef _Tp mapped_type;
00075   typedef typename _Ht::value_type value_type;
00076   typedef typename _Ht::hasher hasher;
00077   typedef typename _Ht::key_equal key_equal;
00078   
00079   typedef typename _Ht::size_type size_type;
00080   typedef typename _Ht::difference_type difference_type;
00081   typedef typename _Ht::pointer pointer;
00082   typedef typename _Ht::const_pointer const_pointer;
00083   typedef typename _Ht::reference reference;
00084   typedef typename _Ht::const_reference const_reference;
00085 
00086   typedef typename _Ht::iterator iterator;
00087   typedef typename _Ht::const_iterator const_iterator;
00088 
00089   typedef typename _Ht::allocator_type allocator_type;
00090 
00091   hasher hash_funct() const { return _M_ht.hash_funct(); }
00092   key_equal key_eq() const { return _M_ht.key_eq(); }
00093   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
00094 
00095 public:
00096   hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
00097   explicit hash_map(size_type __n)
00098     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
00099   hash_map(size_type __n, const hasher& __hf)
00100     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
00101   hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
00102            const allocator_type& __a = allocator_type())
00103     : _M_ht(__n, __hf, __eql, __a) {}
00104 
00105 #ifdef __STL_MEMBER_TEMPLATES
00106   template <class _InputIterator>
00107   hash_map(_InputIterator __f, _InputIterator __l)
00108     : _M_ht(100, hasher(), key_equal(), allocator_type())
00109     { _M_ht.insert_unique(__f, __l); }
00110   template <class _InputIterator>
00111   hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
00112     : _M_ht(__n, hasher(), key_equal(), allocator_type())
00113     { _M_ht.insert_unique(__f, __l); }
00114   template <class _InputIterator>
00115   hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
00116            const hasher& __hf)
00117     : _M_ht(__n, __hf, key_equal(), allocator_type())
00118     { _M_ht.insert_unique(__f, __l); }
00119   template <class _InputIterator>
00120   hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
00121            const hasher& __hf, const key_equal& __eql,
00122            const allocator_type& __a = allocator_type())
00123     : _M_ht(__n, __hf, __eql, __a)
00124     { _M_ht.insert_unique(__f, __l); }
00125 
00126 #else
00127   hash_map(const value_type* __f, const value_type* __l)
00128     : _M_ht(100, hasher(), key_equal(), allocator_type())
00129     { _M_ht.insert_unique(__f, __l); }
00130   hash_map(const value_type* __f, const value_type* __l, size_type __n)
00131     : _M_ht(__n, hasher(), key_equal(), allocator_type())
00132     { _M_ht.insert_unique(__f, __l); }
00133   hash_map(const value_type* __f, const value_type* __l, size_type __n,
00134            const hasher& __hf)
00135     : _M_ht(__n, __hf, key_equal(), allocator_type())
00136     { _M_ht.insert_unique(__f, __l); }
00137   hash_map(const value_type* __f, const value_type* __l, size_type __n,
00138            const hasher& __hf, const key_equal& __eql,
00139            const allocator_type& __a = allocator_type())
00140     : _M_ht(__n, __hf, __eql, __a)
00141     { _M_ht.insert_unique(__f, __l); }
00142 
00143   hash_map(const_iterator __f, const_iterator __l)
00144     : _M_ht(100, hasher(), key_equal(), allocator_type())
00145     { _M_ht.insert_unique(__f, __l); }
00146   hash_map(const_iterator __f, const_iterator __l, size_type __n)
00147     : _M_ht(__n, hasher(), key_equal(), allocator_type())
00148     { _M_ht.insert_unique(__f, __l); }
00149   hash_map(const_iterator __f, const_iterator __l, size_type __n,
00150            const hasher& __hf)
00151     : _M_ht(__n, __hf, key_equal(), allocator_type())
00152     { _M_ht.insert_unique(__f, __l); }
00153   hash_map(const_iterator __f, const_iterator __l, size_type __n,
00154            const hasher& __hf, const key_equal& __eql,
00155            const allocator_type& __a = allocator_type())
00156     : _M_ht(__n, __hf, __eql, __a)
00157     { _M_ht.insert_unique(__f, __l); }
00158 #endif /*__STL_MEMBER_TEMPLATES */
00159 
00160 public:
00161   size_type size() const { return _M_ht.size(); }
00162   size_type max_size() const { return _M_ht.max_size(); }
00163   bool empty() const { return _M_ht.empty(); }
00164   void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
00165 
00166 #ifdef __STL_MEMBER_TEMPLATES
00167   template <class _K1, class _T1, class _HF, class _EqK, class _Al>
00168   friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,
00169                           const hash_map<_K1, _T1, _HF, _EqK, _Al>&);
00170 #else /* __STL_MEMBER_TEMPLATES */
00171   friend bool __STD_QUALIFIER
00172   operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&);
00173 #endif /* __STL_MEMBER_TEMPLATES */
00174 
00175 
00176   iterator begin() { return _M_ht.begin(); }
00177   iterator end() { return _M_ht.end(); }
00178   const_iterator begin() const { return _M_ht.begin(); }
00179   const_iterator end() const { return _M_ht.end(); }
00180 
00181 public:
00182   pair<iterator,bool> insert(const value_type& __obj)
00183     { return _M_ht.insert_unique(__obj); }
00184 #ifdef __STL_MEMBER_TEMPLATES
00185   template <class _InputIterator>
00186   void insert(_InputIterator __f, _InputIterator __l)
00187     { _M_ht.insert_unique(__f,__l); }
00188 #else
00189   void insert(const value_type* __f, const value_type* __l) {
00190     _M_ht.insert_unique(__f,__l);
00191   }
00192   void insert(const_iterator __f, const_iterator __l)
00193     { _M_ht.insert_unique(__f, __l); }
00194 #endif /*__STL_MEMBER_TEMPLATES */
00195   pair<iterator,bool> insert_noresize(const value_type& __obj)
00196     { return _M_ht.insert_unique_noresize(__obj); }    
00197 
00198   iterator find(const key_type& __key) { return _M_ht.find(__key); }
00199   const_iterator find(const key_type& __key) const 
00200     { return _M_ht.find(__key); }
00201 
00202   _Tp& operator[](const key_type& __key) {
00203     return _M_ht.find_or_insert(value_type(__key, _Tp())).second;
00204   }
00205 
00206   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
00207   
00208   pair<iterator, iterator> equal_range(const key_type& __key)
00209     { return _M_ht.equal_range(__key); }
00210   pair<const_iterator, const_iterator>
00211   equal_range(const key_type& __key) const
00212     { return _M_ht.equal_range(__key); }
00213 
00214   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
00215   void erase(iterator __it) { _M_ht.erase(__it); }
00216   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
00217   void clear() { _M_ht.clear(); }
00218 
00219   void resize(size_type __hint) { _M_ht.resize(__hint); }
00220   size_type bucket_count() const { return _M_ht.bucket_count(); }
00221   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
00222   size_type elems_in_bucket(size_type __n) const
00223     { return _M_ht.elems_in_bucket(__n); }
00224 };
00225 
00226 template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
00227 inline bool 
00228 operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
00229            const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
00230 {
00231   return __hm1._M_ht == __hm2._M_ht;
00232 }
00233 
00234 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
00235 
00236 template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
00237 inline bool 
00238 operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
00239            const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) {
00240   return !(__hm1 == __hm2);
00241 }
00242 
00243 template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
00244 inline void 
00245 swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
00246      hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
00247 {
00248   __hm1.swap(__hm2);
00249 }
00250 
00251 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
00252 
00253 // Forward declaration of equality operator; needed for friend declaration.
00254 
00255 template <class _Key, class _Tp,
00256           class _HashFcn  __STL_DEPENDENT_DEFAULT_TMPL(hash<_Key>),
00257           class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Key>),
00258           class _Alloc =  __STL_DEFAULT_ALLOCATOR(_Tp) >
00259 class hash_multimap;
00260 
00261 template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
00262 inline bool 
00263 operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
00264            const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2);
00265 
00266 template <class _Key, class _Tp, class _HashFcn, class _EqualKey, 
00267           class _Alloc>
00268 class hash_multimap
00269 {
00270   // requirements:
00271 
00272   __STL_CLASS_REQUIRES(_Key, _Assignable);
00273   __STL_CLASS_REQUIRES(_Tp, _Assignable);
00274   __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key);
00275   __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key);
00276 
00277 private:
00278   typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn,
00279                     _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> 
00280           _Ht;
00281   _Ht _M_ht;
00282 
00283 public:
00284   typedef typename _Ht::key_type key_type;
00285   typedef _Tp data_type;
00286   typedef _Tp mapped_type;
00287   typedef typename _Ht::value_type value_type;
00288   typedef typename _Ht::hasher hasher;
00289   typedef typename _Ht::key_equal key_equal;
00290 
00291   typedef typename _Ht::size_type size_type;
00292   typedef typename _Ht::difference_type difference_type;
00293   typedef typename _Ht::pointer pointer;
00294   typedef typename _Ht::const_pointer const_pointer;
00295   typedef typename _Ht::reference reference;
00296   typedef typename _Ht::const_reference const_reference;
00297 
00298   typedef typename _Ht::iterator iterator;
00299   typedef typename _Ht::const_iterator const_iterator;
00300 
00301   typedef typename _Ht::allocator_type allocator_type;
00302 
00303   hasher hash_funct() const { return _M_ht.hash_funct(); }
00304   key_equal key_eq() const { return _M_ht.key_eq(); }
00305   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
00306 
00307 public:
00308   hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
00309   explicit hash_multimap(size_type __n)
00310     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
00311   hash_multimap(size_type __n, const hasher& __hf)
00312     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
00313   hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
00314                 const allocator_type& __a = allocator_type())
00315     : _M_ht(__n, __hf, __eql, __a) {}
00316 
00317 #ifdef __STL_MEMBER_TEMPLATES
00318   template <class _InputIterator>
00319   hash_multimap(_InputIterator __f, _InputIterator __l)
00320     : _M_ht(100, hasher(), key_equal(), allocator_type())
00321     { _M_ht.insert_equal(__f, __l); }
00322   template <class _InputIterator>
00323   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
00324     : _M_ht(__n, hasher(), key_equal(), allocator_type())
00325     { _M_ht.insert_equal(__f, __l); }
00326   template <class _InputIterator>
00327   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
00328                 const hasher& __hf)
00329     : _M_ht(__n, __hf, key_equal(), allocator_type())
00330     { _M_ht.insert_equal(__f, __l); }
00331   template <class _InputIterator>
00332   hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
00333                 const hasher& __hf, const key_equal& __eql,
00334                 const allocator_type& __a = allocator_type())
00335     : _M_ht(__n, __hf, __eql, __a)
00336     { _M_ht.insert_equal(__f, __l); }
00337 
00338 #else
00339   hash_multimap(const value_type* __f, const value_type* __l)
00340     : _M_ht(100, hasher(), key_equal(), allocator_type())
00341     { _M_ht.insert_equal(__f, __l); }
00342   hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
00343     : _M_ht(__n, hasher(), key_equal(), allocator_type())
00344     { _M_ht.insert_equal(__f, __l); }
00345   hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
00346                 const hasher& __hf)
00347     : _M_ht(__n, __hf, key_equal(), allocator_type())
00348     { _M_ht.insert_equal(__f, __l); }
00349   hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
00350                 const hasher& __hf, const key_equal& __eql,
00351                 const allocator_type& __a = allocator_type())
00352     : _M_ht(__n, __hf, __eql, __a)
00353     { _M_ht.insert_equal(__f, __l); }
00354 
00355   hash_multimap(const_iterator __f, const_iterator __l)
00356     : _M_ht(100, hasher(), key_equal(), allocator_type())
00357     { _M_ht.insert_equal(__f, __l); }
00358   hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
00359     : _M_ht(__n, hasher(), key_equal(), allocator_type())
00360     { _M_ht.insert_equal(__f, __l); }
00361   hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
00362                 const hasher& __hf)
00363     : _M_ht(__n, __hf, key_equal(), allocator_type())
00364     { _M_ht.insert_equal(__f, __l); }
00365   hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
00366                 const hasher& __hf, const key_equal& __eql,
00367                 const allocator_type& __a = allocator_type())
00368     : _M_ht(__n, __hf, __eql, __a)
00369     { _M_ht.insert_equal(__f, __l); }
00370 #endif /*__STL_MEMBER_TEMPLATES */
00371 
00372 public:
00373   size_type size() const { return _M_ht.size(); }
00374   size_type max_size() const { return _M_ht.max_size(); }
00375   bool empty() const { return _M_ht.empty(); }
00376   void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
00377 
00378 #ifdef __STL_MEMBER_TEMPLATES
00379   template <class _K1, class _T1, class _HF, class _EqK, class _Al>
00380   friend bool operator== (const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
00381                           const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
00382 #else /* __STL_MEMBER_TEMPLATES */
00383   friend bool __STD_QUALIFIER
00384   operator== __STL_NULL_TMPL_ARGS (const hash_multimap&,const hash_multimap&);
00385 #endif /* __STL_MEMBER_TEMPLATES */
00386 
00387   iterator begin() { return _M_ht.begin(); }
00388   iterator end() { return _M_ht.end(); }
00389   const_iterator begin() const { return _M_ht.begin(); }
00390   const_iterator end() const { return _M_ht.end(); }
00391 
00392 public:
00393   iterator insert(const value_type& __obj) 
00394     { return _M_ht.insert_equal(__obj); }
00395 #ifdef __STL_MEMBER_TEMPLATES
00396   template <class _InputIterator>
00397   void insert(_InputIterator __f, _InputIterator __l) 
00398     { _M_ht.insert_equal(__f,__l); }
00399 #else
00400   void insert(const value_type* __f, const value_type* __l) {
00401     _M_ht.insert_equal(__f,__l);
00402   }
00403   void insert(const_iterator __f, const_iterator __l) 
00404     { _M_ht.insert_equal(__f, __l); }
00405 #endif /*__STL_MEMBER_TEMPLATES */
00406   iterator insert_noresize(const value_type& __obj)
00407     { return _M_ht.insert_equal_noresize(__obj); }    
00408 
00409   iterator find(const key_type& __key) { return _M_ht.find(__key); }
00410   const_iterator find(const key_type& __key) const 
00411     { return _M_ht.find(__key); }
00412 
00413   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
00414   
00415   pair<iterator, iterator> equal_range(const key_type& __key)
00416     { return _M_ht.equal_range(__key); }
00417   pair<const_iterator, const_iterator>
00418   equal_range(const key_type& __key) const
00419     { return _M_ht.equal_range(__key); }
00420 
00421   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
00422   void erase(iterator __it) { _M_ht.erase(__it); }
00423   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
00424   void clear() { _M_ht.clear(); }
00425 
00426 public:
00427   void resize(size_type __hint) { _M_ht.resize(__hint); }
00428   size_type bucket_count() const { return _M_ht.bucket_count(); }
00429   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
00430   size_type elems_in_bucket(size_type __n) const
00431     { return _M_ht.elems_in_bucket(__n); }
00432 };
00433 
00434 template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
00435 inline bool 
00436 operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
00437            const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2)
00438 {
00439   return __hm1._M_ht == __hm2._M_ht;
00440 }
00441 
00442 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
00443 
00444 template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
00445 inline bool 
00446 operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
00447            const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) {
00448   return !(__hm1 == __hm2);
00449 }
00450 
00451 template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
00452 inline void 
00453 swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
00454      hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
00455 {
00456   __hm1.swap(__hm2);
00457 }
00458 
00459 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
00460 
00461 // Specialization of insert_iterator so that it will work for hash_map
00462 // and hash_multimap.
00463 
00464 #ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
00465 
00466 template <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
00467 class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
00468 protected:
00469   typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
00470   _Container* container;
00471 public:
00472   typedef _Container          container_type;
00473   typedef output_iterator_tag iterator_category;
00474   typedef void                value_type;
00475   typedef void                difference_type;
00476   typedef void                pointer;
00477   typedef void                reference;
00478 
00479   insert_iterator(_Container& __x) : container(&__x) {}
00480   insert_iterator(_Container& __x, typename _Container::iterator)
00481     : container(&__x) {}
00482   insert_iterator<_Container>&
00483   operator=(const typename _Container::value_type& __value) { 
00484     container->insert(__value);
00485     return *this;
00486   }
00487   insert_iterator<_Container>& operator*() { return *this; }
00488   insert_iterator<_Container>& operator++() { return *this; }
00489   insert_iterator<_Container>& operator++(int) { return *this; }
00490 };
00491 
00492 template <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
00493 class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
00494 protected:
00495   typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
00496   _Container* container;
00497   typename _Container::iterator iter;
00498 public:
00499   typedef _Container          container_type;
00500   typedef output_iterator_tag iterator_category;
00501   typedef void                value_type;
00502   typedef void                difference_type;
00503   typedef void                pointer;
00504   typedef void                reference;
00505 
00506   insert_iterator(_Container& __x) : container(&__x) {}
00507   insert_iterator(_Container& __x, typename _Container::iterator)
00508     : container(&__x) {}
00509   insert_iterator<_Container>&
00510   operator=(const typename _Container::value_type& __value) { 
00511     container->insert(__value);
00512     return *this;
00513   }
00514   insert_iterator<_Container>& operator*() { return *this; }
00515   insert_iterator<_Container>& operator++() { return *this; }
00516   insert_iterator<_Container>& operator++(int) { return *this; }
00517 };
00518 
00519 #endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
00520 
00521 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00522 #pragma reset woff 1174
00523 #pragma reset woff 1375
00524 #endif
00525 
00526 __STL_END_NAMESPACE
00527 
00528 #endif /* __SGI_STL_INTERNAL_HASH_MAP_H */
00529 
00530 // Local Variables:
00531 // mode:C++
00532 // End:

Generated on Mon Jun 5 10:20:44 2006 for Intelligence.kdevelop by  doxygen 1.4.6