home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / stl / stl_hash_set.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-08  |  19.2 KB  |  515 lines

  1. /*
  2.  * Copyright (c) 1996
  3.  * Silicon Graphics Computer Systems, Inc.
  4.  *
  5.  * Permission to use, copy, modify, distribute and sell this software
  6.  * and its documentation for any purpose is hereby granted without fee,
  7.  * provided that the above copyright notice appear in all copies and
  8.  * that both that copyright notice and this permission notice appear
  9.  * in supporting documentation.  Silicon Graphics makes no
  10.  * representations about the suitability of this software for any
  11.  * purpose.  It is provided "as is" without express or implied warranty.
  12.  *
  13.  *
  14.  * Copyright (c) 1994
  15.  * Hewlett-Packard Company
  16.  *
  17.  * Permission to use, copy, modify, distribute and sell this software
  18.  * and its documentation for any purpose is hereby granted without fee,
  19.  * provided that the above copyright notice appear in all copies and
  20.  * that both that copyright notice and this permission notice appear
  21.  * in supporting documentation.  Hewlett-Packard Company makes no
  22.  * representations about the suitability of this software for any
  23.  * purpose.  It is provided "as is" without express or implied warranty.
  24.  *
  25.  */
  26.  
  27. /* NOTE: This is an internal header file, included by other STL headers.
  28.  *   You should not attempt to use it directly.
  29.  */
  30.  
  31. #ifndef __SGI_STL_INTERNAL_HASH_SET_H
  32. #define __SGI_STL_INTERNAL_HASH_SET_H
  33.  
  34. #include <concept_checks.h>
  35.  
  36. __STL_BEGIN_NAMESPACE
  37.  
  38. #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
  39. #pragma set woff 1174
  40. #pragma set woff 1375
  41. #endif
  42.  
  43. // Forward declaration of equality operator; needed for friend declaration.
  44.  
  45. template <class _Value,
  46.           class _HashFcn  __STL_DEPENDENT_DEFAULT_TMPL(hash<_Value>),
  47.           class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Value>),
  48.           class _Alloc =  __STL_DEFAULT_ALLOCATOR(_Value) >
  49. class hash_set;
  50.  
  51. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  52. inline bool 
  53. operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  54.            const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2);
  55.  
  56. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  57. class hash_set
  58. {
  59.   // requirements:
  60.  
  61.   __STL_CLASS_REQUIRES(_Value, _Assignable);
  62.   __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value);
  63.   __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value);
  64.  
  65. private:
  66.   typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, 
  67.                     _EqualKey, _Alloc> _Ht;
  68.   _Ht _M_ht;
  69.  
  70. public:
  71.   typedef typename _Ht::key_type key_type;
  72.   typedef typename _Ht::value_type value_type;
  73.   typedef typename _Ht::hasher hasher;
  74.   typedef typename _Ht::key_equal key_equal;
  75.  
  76.   typedef typename _Ht::size_type size_type;
  77.   typedef typename _Ht::difference_type difference_type;
  78.   typedef typename _Ht::const_pointer pointer;
  79.   typedef typename _Ht::const_pointer const_pointer;
  80.   typedef typename _Ht::const_reference reference;
  81.   typedef typename _Ht::const_reference const_reference;
  82.  
  83.   typedef typename _Ht::const_iterator iterator;
  84.   typedef typename _Ht::const_iterator const_iterator;
  85.  
  86.   typedef typename _Ht::allocator_type allocator_type;
  87.  
  88.   hasher hash_funct() const { return _M_ht.hash_funct(); }
  89.   key_equal key_eq() const { return _M_ht.key_eq(); }
  90.   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
  91.  
  92. public:
  93.   hash_set()
  94.     : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
  95.   explicit hash_set(size_type __n)
  96.     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
  97.   hash_set(size_type __n, const hasher& __hf)
  98.     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
  99.   hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
  100.            const allocator_type& __a = allocator_type())
  101.     : _M_ht(__n, __hf, __eql, __a) {}
  102.  
  103. #ifdef __STL_MEMBER_TEMPLATES
  104.   template <class _InputIterator>
  105.   hash_set(_InputIterator __f, _InputIterator __l)
  106.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  107.     { _M_ht.insert_unique(__f, __l); }
  108.   template <class _InputIterator>
  109.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
  110.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  111.     { _M_ht.insert_unique(__f, __l); }
  112.   template <class _InputIterator>
  113.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
  114.            const hasher& __hf)
  115.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  116.     { _M_ht.insert_unique(__f, __l); }
  117.   template <class _InputIterator>
  118.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
  119.            const hasher& __hf, const key_equal& __eql,
  120.            const allocator_type& __a = allocator_type())
  121.     : _M_ht(__n, __hf, __eql, __a)
  122.     { _M_ht.insert_unique(__f, __l); }
  123. #else
  124.  
  125.   hash_set(const value_type* __f, const value_type* __l)
  126.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  127.     { _M_ht.insert_unique(__f, __l); }
  128.   hash_set(const value_type* __f, const value_type* __l, size_type __n)
  129.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  130.     { _M_ht.insert_unique(__f, __l); }
  131.   hash_set(const value_type* __f, const value_type* __l, size_type __n,
  132.            const hasher& __hf)
  133.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  134.     { _M_ht.insert_unique(__f, __l); }
  135.   hash_set(const value_type* __f, const value_type* __l, size_type __n,
  136.            const hasher& __hf, const key_equal& __eql,
  137.            const allocator_type& __a = allocator_type())
  138.     : _M_ht(__n, __hf, __eql, __a)
  139.     { _M_ht.insert_unique(__f, __l); }
  140.  
  141.   hash_set(const_iterator __f, const_iterator __l)
  142.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  143.     { _M_ht.insert_unique(__f, __l); }
  144.   hash_set(const_iterator __f, const_iterator __l, size_type __n)
  145.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  146.     { _M_ht.insert_unique(__f, __l); }
  147.   hash_set(const_iterator __f, const_iterator __l, size_type __n,
  148.            const hasher& __hf)
  149.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  150.     { _M_ht.insert_unique(__f, __l); }
  151.   hash_set(const_iterator __f, const_iterator __l, size_type __n,
  152.            const hasher& __hf, const key_equal& __eql,
  153.            const allocator_type& __a = allocator_type())
  154.     : _M_ht(__n, __hf, __eql, __a)
  155.     { _M_ht.insert_unique(__f, __l); }
  156. #endif /*__STL_MEMBER_TEMPLATES */
  157.  
  158. public:
  159.   size_type size() const { return _M_ht.size(); }
  160.   size_type max_size() const { return _M_ht.max_size(); }
  161.   bool empty() const { return _M_ht.empty(); }
  162.   void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
  163.  
  164. #ifdef __STL_MEMBER_TEMPLATES
  165.   template <class _Val, class _HF, class _EqK, class _Al>  
  166.   friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&,
  167.                           const hash_set<_Val, _HF, _EqK, _Al>&);
  168. #else /* __STL_MEMBER_TEMPLATES */
  169.   friend bool __STD_QUALIFIER
  170.   operator== __STL_NULL_TMPL_ARGS (const hash_set&, const hash_set&);
  171. #endif /* __STL_MEMBER_TEMPLATES */
  172.  
  173.   iterator begin() const { return _M_ht.begin(); }
  174.   iterator end() const { return _M_ht.end(); }
  175.  
  176. public:
  177.   pair<iterator, bool> insert(const value_type& __obj)
  178.     {
  179.       pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
  180.       return pair<iterator,bool>(__p.first, __p.second);
  181.     }
  182. #ifdef __STL_MEMBER_TEMPLATES
  183.   template <class _InputIterator>
  184.   void insert(_InputIterator __f, _InputIterator __l) 
  185.     { _M_ht.insert_unique(__f,__l); }
  186. #else
  187.   void insert(const value_type* __f, const value_type* __l) {
  188.     _M_ht.insert_unique(__f,__l);
  189.   }
  190.   void insert(const_iterator __f, const_iterator __l) 
  191.     {_M_ht.insert_unique(__f, __l); }
  192. #endif /*__STL_MEMBER_TEMPLATES */
  193.   pair<iterator, bool> insert_noresize(const value_type& __obj)
  194.   {
  195.     pair<typename _Ht::iterator, bool> __p = 
  196.       _M_ht.insert_unique_noresize(__obj);
  197.     return pair<iterator, bool>(__p.first, __p.second);
  198.   }
  199.  
  200.   iterator find(const key_type& __key) const { return _M_ht.find(__key); }
  201.  
  202.   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
  203.   
  204.   pair<iterator, iterator> equal_range(const key_type& __key) const
  205.     { return _M_ht.equal_range(__key); }
  206.  
  207.   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
  208.   void erase(iterator __it) { _M_ht.erase(__it); }
  209.   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
  210.   void clear() { _M_ht.clear(); }
  211.  
  212. public:
  213.   void resize(size_type __hint) { _M_ht.resize(__hint); }
  214.   size_type bucket_count() const { return _M_ht.bucket_count(); }
  215.   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
  216.   size_type elems_in_bucket(size_type __n) const
  217.     { return _M_ht.elems_in_bucket(__n); }
  218. };
  219.  
  220. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  221. inline bool 
  222. operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  223.            const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
  224. {
  225.   return __hs1._M_ht == __hs2._M_ht;
  226. }
  227.  
  228. #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
  229.  
  230. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  231. inline bool 
  232. operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  233.            const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) {
  234.   return !(__hs1 == __hs2);
  235. }
  236.  
  237. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  238. inline void 
  239. swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  240.      hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
  241. {
  242.   __hs1.swap(__hs2);
  243. }
  244.  
  245. #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
  246.  
  247.  
  248. template <class _Value,
  249.           class _HashFcn  __STL_DEPENDENT_DEFAULT_TMPL(hash<_Value>),
  250.           class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Value>),
  251.           class _Alloc =  __STL_DEFAULT_ALLOCATOR(_Value) >
  252. class hash_multiset;
  253.  
  254. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  255. inline bool 
  256. operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  257.            const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2);
  258.  
  259.  
  260. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  261. class hash_multiset
  262. {
  263.   // requirements:
  264.  
  265.   __STL_CLASS_REQUIRES(_Value, _Assignable);
  266.   __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value);
  267.   __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value);
  268.  
  269. private:
  270.   typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, 
  271.                     _EqualKey, _Alloc> _Ht;
  272.   _Ht _M_ht;
  273.  
  274. public:
  275.   typedef typename _Ht::key_type key_type;
  276.   typedef typename _Ht::value_type value_type;
  277.   typedef typename _Ht::hasher hasher;
  278.   typedef typename _Ht::key_equal key_equal;
  279.  
  280.   typedef typename _Ht::size_type size_type;
  281.   typedef typename _Ht::difference_type difference_type;
  282.   typedef typename _Ht::const_pointer pointer;
  283.   typedef typename _Ht::const_pointer const_pointer;
  284.   typedef typename _Ht::const_reference reference;
  285.   typedef typename _Ht::const_reference const_reference;
  286.  
  287.   typedef typename _Ht::const_iterator iterator;
  288.   typedef typename _Ht::const_iterator const_iterator;
  289.  
  290.   typedef typename _Ht::allocator_type allocator_type;
  291.  
  292.   hasher hash_funct() const { return _M_ht.hash_funct(); }
  293.   key_equal key_eq() const { return _M_ht.key_eq(); }
  294.   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
  295.  
  296. public:
  297.   hash_multiset()
  298.     : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
  299.   explicit hash_multiset(size_type __n)
  300.     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
  301.   hash_multiset(size_type __n, const hasher& __hf)
  302.     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
  303.   hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
  304.                 const allocator_type& __a = allocator_type())
  305.     : _M_ht(__n, __hf, __eql, __a) {}
  306.  
  307. #ifdef __STL_MEMBER_TEMPLATES
  308.   template <class _InputIterator>
  309.   hash_multiset(_InputIterator __f, _InputIterator __l)
  310.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  311.     { _M_ht.insert_equal(__f, __l); }
  312.   template <class _InputIterator>
  313.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
  314.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  315.     { _M_ht.insert_equal(__f, __l); }
  316.   template <class _InputIterator>
  317.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
  318.                 const hasher& __hf)
  319.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  320.     { _M_ht.insert_equal(__f, __l); }
  321.   template <class _InputIterator>
  322.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
  323.                 const hasher& __hf, const key_equal& __eql,
  324.                 const allocator_type& __a = allocator_type())
  325.     : _M_ht(__n, __hf, __eql, __a)
  326.     { _M_ht.insert_equal(__f, __l); }
  327. #else
  328.  
  329.   hash_multiset(const value_type* __f, const value_type* __l)
  330.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  331.     { _M_ht.insert_equal(__f, __l); }
  332.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
  333.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  334.     { _M_ht.insert_equal(__f, __l); }
  335.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
  336.                 const hasher& __hf)
  337.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  338.     { _M_ht.insert_equal(__f, __l); }
  339.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
  340.                 const hasher& __hf, const key_equal& __eql,
  341.                 const allocator_type& __a = allocator_type())
  342.     : _M_ht(__n, __hf, __eql, __a)
  343.     { _M_ht.insert_equal(__f, __l); }
  344.  
  345.   hash_multiset(const_iterator __f, const_iterator __l)
  346.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  347.     { _M_ht.insert_equal(__f, __l); }
  348.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
  349.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  350.     { _M_ht.insert_equal(__f, __l); }
  351.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
  352.                 const hasher& __hf)
  353.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  354.     { _M_ht.insert_equal(__f, __l); }
  355.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
  356.                 const hasher& __hf, const key_equal& __eql,
  357.                 const allocator_type& __a = allocator_type())
  358.     : _M_ht(__n, __hf, __eql, __a)
  359.     { _M_ht.insert_equal(__f, __l); }
  360. #endif /*__STL_MEMBER_TEMPLATES */
  361.  
  362. public:
  363.   size_type size() const { return _M_ht.size(); }
  364.   size_type max_size() const { return _M_ht.max_size(); }
  365.   bool empty() const { return _M_ht.empty(); }
  366.   void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
  367.  
  368. #ifdef __STL_MEMBER_TEMPLATES
  369.   template <class _Val, class _HF, class _EqK, class _Al>  
  370.   friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&,
  371.                           const hash_multiset<_Val, _HF, _EqK, _Al>&);
  372. #else /* __STL_MEMBER_TEMPLATES */
  373.   friend bool __STD_QUALIFIER
  374.   operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,const hash_multiset&);
  375. #endif /* __STL_MEMBER_TEMPLATES */
  376.  
  377.   iterator begin() const { return _M_ht.begin(); }
  378.   iterator end() const { return _M_ht.end(); }
  379.  
  380. public:
  381.   iterator insert(const value_type& __obj)
  382.     { return _M_ht.insert_equal(__obj); }
  383. #ifdef __STL_MEMBER_TEMPLATES
  384.   template <class _InputIterator>
  385.   void insert(_InputIterator __f, _InputIterator __l) 
  386.     { _M_ht.insert_equal(__f,__l); }
  387. #else
  388.   void insert(const value_type* __f, const value_type* __l) {
  389.     _M_ht.insert_equal(__f,__l);
  390.   }
  391.   void insert(const_iterator __f, const_iterator __l) 
  392.     { _M_ht.insert_equal(__f, __l); }
  393. #endif /*__STL_MEMBER_TEMPLATES */
  394.   iterator insert_noresize(const value_type& __obj)
  395.     { return _M_ht.insert_equal_noresize(__obj); }    
  396.  
  397.   iterator find(const key_type& __key) const { return _M_ht.find(__key); }
  398.  
  399.   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
  400.   
  401.   pair<iterator, iterator> equal_range(const key_type& __key) const
  402.     { return _M_ht.equal_range(__key); }
  403.  
  404.   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
  405.   void erase(iterator __it) { _M_ht.erase(__it); }
  406.   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
  407.   void clear() { _M_ht.clear(); }
  408.  
  409. public:
  410.   void resize(size_type __hint) { _M_ht.resize(__hint); }
  411.   size_type bucket_count() const { return _M_ht.bucket_count(); }
  412.   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
  413.   size_type elems_in_bucket(size_type __n) const
  414.     { return _M_ht.elems_in_bucket(__n); }
  415. };
  416.  
  417. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  418. inline bool 
  419. operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  420.            const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
  421. {
  422.   return __hs1._M_ht == __hs2._M_ht;
  423. }
  424.  
  425. #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
  426.  
  427. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  428. inline bool 
  429. operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  430.            const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
  431.   return !(__hs1 == __hs2);
  432. }
  433.  
  434. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  435. inline void 
  436. swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  437.      hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
  438.   __hs1.swap(__hs2);
  439. }
  440.  
  441. #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
  442.  
  443. // Specialization of insert_iterator so that it will work for hash_set
  444. // and hash_multiset.
  445.  
  446. #ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
  447.  
  448. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  449. class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
  450. protected:
  451.   typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
  452.   _Container* container;
  453. public:
  454.   typedef _Container          container_type;
  455.   typedef output_iterator_tag iterator_category;
  456.   typedef void                value_type;
  457.   typedef void                difference_type;
  458.   typedef void                pointer;
  459.   typedef void                reference;
  460.  
  461.   insert_iterator(_Container& __x) : container(&__x) {}
  462.   insert_iterator(_Container& __x, typename _Container::iterator)
  463.     : container(&__x) {}
  464.   insert_iterator<_Container>&
  465.   operator=(const typename _Container::value_type& __value) { 
  466.     container->insert(__value);
  467.     return *this;
  468.   }
  469.   insert_iterator<_Container>& operator*() { return *this; }
  470.   insert_iterator<_Container>& operator++() { return *this; }
  471.   insert_iterator<_Container>& operator++(int) { return *this; }
  472. };
  473.  
  474. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  475. class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
  476. protected:
  477.   typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
  478.   _Container* container;
  479.   typename _Container::iterator iter;
  480. public:
  481.   typedef _Container          container_type;
  482.   typedef output_iterator_tag iterator_category;
  483.   typedef void                value_type;
  484.   typedef void                difference_type;
  485.   typedef void                pointer;
  486.   typedef void                reference;
  487.  
  488.   insert_iterator(_Container& __x) : container(&__x) {}
  489.   insert_iterator(_Container& __x, typename _Container::iterator)
  490.     : container(&__x) {}
  491.   insert_iterator<_Container>&
  492.   operator=(const typename _Container::value_type& __value) { 
  493.     container->insert(__value);
  494.     return *this;
  495.   }
  496.   insert_iterator<_Container>& operator*() { return *this; }
  497.   insert_iterator<_Container>& operator++() { return *this; }
  498.   insert_iterator<_Container>& operator++(int) { return *this; }
  499. };
  500.  
  501. #endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
  502.  
  503. #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
  504. #pragma reset woff 1174
  505. #pragma reset woff 1375
  506. #endif
  507.  
  508. __STL_END_NAMESPACE
  509.  
  510. #endif /* __SGI_STL_INTERNAL_HASH_SET_H */
  511.  
  512. // Local Variables:
  513. // mode:C++
  514. // End:
  515.