home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / stl / _hash_set.h < prev    next >
C/C++ Source or Header  |  2002-02-02  |  19KB  |  514 lines

  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_SET_H
  31. #define _STLP_INTERNAL_HASH_SET_H
  32.  
  33. #ifndef _STLP_INTERNAL_HASHTABLE_H
  34. # include <stl/_hashtable.h>
  35. #endif
  36.  
  37. # define  hash_set      __WORKAROUND_RENAME(hash_set)
  38. # define  hash_multiset __WORKAROUND_RENAME(hash_multiset)
  39.  
  40. _STLP_BEGIN_NAMESPACE
  41.  
  42. template <class _Value, __DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
  43.           __DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
  44.           _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
  45. class hash_set
  46. {
  47. private:
  48.   typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, 
  49.                     _EqualKey, _Alloc> _Ht;
  50.   typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
  51.   typedef typename _Ht::iterator _ht_iterator;
  52. public:
  53.   typedef typename _Ht::key_type key_type;
  54.   typedef typename _Ht::value_type value_type;
  55.   typedef typename _Ht::hasher hasher;
  56.   typedef typename _Ht::key_equal key_equal;
  57.  
  58.   typedef typename _Ht::size_type size_type;
  59.   typedef typename _Ht::difference_type difference_type;
  60.   typedef typename _Ht::pointer         pointer;
  61.   typedef typename _Ht::const_pointer   const_pointer;
  62.   typedef typename _Ht::reference       reference;
  63.   typedef typename _Ht::const_reference const_reference;
  64.  
  65.   // SunPro bug
  66.   typedef typename _Ht::const_iterator const_iterator;
  67.   typedef const_iterator iterator;
  68.  
  69.   typedef typename _Ht::allocator_type allocator_type;
  70.  
  71.   hasher hash_funct() const { return _M_ht.hash_funct(); }
  72.   key_equal key_eq() const { return _M_ht.key_eq(); }
  73.   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
  74.  
  75. private:
  76.   _Ht _M_ht;
  77.  
  78. public:
  79.   hash_set()
  80.     : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
  81.   explicit hash_set(size_type __n)
  82.     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
  83.   hash_set(size_type __n, const hasher& __hf)
  84.     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
  85.   hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
  86.            const allocator_type& __a = allocator_type())
  87.     : _M_ht(__n, __hf, __eql, __a) {}
  88.  
  89. #ifdef _STLP_MEMBER_TEMPLATES
  90.   template <class _InputIterator>
  91.   hash_set(_InputIterator __f, _InputIterator __l)
  92.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  93.     { _M_ht.insert_unique(__f, __l); }
  94.   template <class _InputIterator>
  95.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
  96.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  97.     { _M_ht.insert_unique(__f, __l); }
  98.   template <class _InputIterator>
  99.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
  100.            const hasher& __hf)
  101.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  102.     { _M_ht.insert_unique(__f, __l); }
  103. # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
  104.   template <class _InputIterator>
  105.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
  106.            const hasher& __hf, const key_equal& __eql)
  107.     : _M_ht(__n, __hf, __eql, allocator_type())
  108.     { _M_ht.insert_unique(__f, __l); }
  109. #  endif
  110.   template <class _InputIterator>
  111.   hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
  112.            const hasher& __hf, const key_equal& __eql,
  113.            const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
  114.     : _M_ht(__n, __hf, __eql, __a)
  115.     { _M_ht.insert_unique(__f, __l); }
  116. #else
  117.  
  118.   hash_set(const value_type* __f, const value_type* __l)
  119.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  120.     { _M_ht.insert_unique(__f, __l); }
  121.   hash_set(const value_type* __f, const value_type* __l, size_type __n)
  122.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  123.     { _M_ht.insert_unique(__f, __l); }
  124.   hash_set(const value_type* __f, const value_type* __l, size_type __n,
  125.            const hasher& __hf)
  126.     : _M_ht(__n, __hf, 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.            const hasher& __hf, const key_equal& __eql,
  130.            const allocator_type& __a = allocator_type())
  131.     : _M_ht(__n, __hf, __eql, __a)
  132.     { _M_ht.insert_unique(__f, __l); }
  133.  
  134.   hash_set(const_iterator __f, const_iterator __l)
  135.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  136.     { _M_ht.insert_unique(__f, __l); }
  137.   hash_set(const_iterator __f, const_iterator __l, size_type __n)
  138.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  139.     { _M_ht.insert_unique(__f, __l); }
  140.   hash_set(const_iterator __f, const_iterator __l, size_type __n,
  141.            const hasher& __hf)
  142.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  143.     { _M_ht.insert_unique(__f, __l); }
  144.   hash_set(const_iterator __f, const_iterator __l, size_type __n,
  145.            const hasher& __hf, const key_equal& __eql,
  146.            const allocator_type& __a = allocator_type())
  147.     : _M_ht(__n, __hf, __eql, __a)
  148.     { _M_ht.insert_unique(__f, __l); }
  149. #endif /*_STLP_MEMBER_TEMPLATES */
  150.  
  151. public:
  152.   size_type size() const { return _M_ht.size(); }
  153.   size_type max_size() const { return _M_ht.max_size(); }
  154.   bool empty() const { return _M_ht.empty(); }
  155.   void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
  156.  
  157.   iterator begin() const { return _M_ht.begin(); }
  158.   iterator end() const { return _M_ht.end(); }
  159.  
  160. public:
  161.   pair<iterator, bool> insert(const value_type& __obj)
  162.     {
  163.       pair<_ht_iterator, bool> __p = _M_ht.insert_unique(__obj);
  164.       return pair<iterator,bool>(__REINTERPRET_CAST(const iterator&, __p.first), __p.second);
  165.     }
  166. #ifdef _STLP_MEMBER_TEMPLATES
  167.   template <class _InputIterator>
  168.   void insert(_InputIterator __f, _InputIterator __l) 
  169.     { _M_ht.insert_unique(__f,__l); }
  170. #else
  171.   void insert(const value_type* __f, const value_type* __l) {
  172.     _M_ht.insert_unique(__f,__l);
  173.   }
  174.   void insert(const_iterator __f, const_iterator __l) 
  175.     {_M_ht.insert_unique(__f, __l); }
  176.  
  177. #endif /*_STLP_MEMBER_TEMPLATES */
  178.   pair<iterator, bool> insert_noresize(const value_type& __obj)
  179.   {
  180.     pair<_ht_iterator, bool> __p = 
  181.       _M_ht.insert_unique_noresize(__obj);
  182.     return pair<iterator, bool>(__p.first, __p.second);
  183.   }
  184.  
  185. # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )
  186.   template <class _KT>
  187.   iterator find(const _KT& __key) const { return _M_ht.find(__key); }
  188. # else
  189.   iterator find(const key_type& __key) const { return _M_ht.find(__key); }
  190. # endif
  191.   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
  192.   
  193.   pair<iterator, iterator> equal_range(const key_type& __key) const
  194.     { return _M_ht.equal_range(__key); }
  195.  
  196.   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
  197.   void erase(iterator __it) { _M_ht.erase(__it); }
  198.   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
  199.   void clear() { _M_ht.clear(); }
  200.  
  201. public:
  202.   void resize(size_type __hint) { _M_ht.resize(__hint); }
  203.   size_type bucket_count() const { return _M_ht.bucket_count(); }
  204.   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
  205.   size_type elems_in_bucket(size_type __n) const
  206.     { return _M_ht.elems_in_bucket(__n); }
  207.  
  208.   static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
  209.     return _Ht::_M_equal(__x._M_ht,__y._M_ht);
  210.   }
  211.  
  212. };
  213.  
  214.  
  215. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  216. inline bool _STLP_CALL 
  217. operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  218.            const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
  219. {
  220.   return hash_set<_Value,_HashFcn,_EqualKey,_Alloc>::_M_equal(__hs1, __hs2);
  221. }
  222.  
  223. #ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
  224.  
  225. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  226. inline bool _STLP_CALL 
  227. operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  228.            const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) {
  229.   return !(__hs1 == __hs2);
  230. }
  231.  
  232. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  233. inline void _STLP_CALL
  234. swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  235.      hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
  236. {
  237.   __hs1.swap(__hs2);
  238. }
  239.  
  240. #endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
  241.  
  242.  
  243. template <class _Value, __DFL_TMPL_PARAM(_HashFcn,hash<_Value>),
  244.           __DFL_TMPL_PARAM(_EqualKey,equal_to<_Value>),
  245.           _STLP_DEFAULT_ALLOCATOR_SELECT(_Value) >
  246. class hash_multiset
  247. {
  248. private:
  249.   typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, 
  250.                     _EqualKey, _Alloc> _Ht;
  251.   typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self;
  252.  
  253. public:
  254.   typedef typename _Ht::key_type key_type;
  255.   typedef typename _Ht::value_type value_type;
  256.   typedef typename _Ht::hasher hasher;
  257.   typedef typename _Ht::key_equal key_equal;
  258.  
  259.   typedef typename _Ht::size_type size_type;
  260.   typedef typename _Ht::difference_type difference_type;
  261.   typedef typename _Ht::pointer       pointer;
  262.   typedef typename _Ht::const_pointer const_pointer;
  263.   typedef typename _Ht::reference reference;
  264.   typedef typename _Ht::const_reference const_reference;
  265.  
  266.   typedef typename _Ht::const_iterator const_iterator;
  267.   // SunPro bug
  268.   typedef const_iterator iterator;
  269.  
  270.   typedef typename _Ht::allocator_type allocator_type;
  271.  
  272.   hasher hash_funct() const { return _M_ht.hash_funct(); }
  273.   key_equal key_eq() const { return _M_ht.key_eq(); }
  274.   allocator_type get_allocator() const { return _M_ht.get_allocator(); }
  275.  
  276. private:
  277.   _Ht _M_ht;
  278.  
  279. public:
  280.   hash_multiset()
  281.     : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
  282.   explicit hash_multiset(size_type __n)
  283.     : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
  284.   hash_multiset(size_type __n, const hasher& __hf)
  285.     : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
  286.   hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql)
  287.     : _M_ht(__n, __hf, __eql, allocator_type()) {}
  288.   hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
  289.                 const allocator_type& __a)
  290.     : _M_ht(__n, __hf, __eql, __a) {}
  291.  
  292. #ifdef _STLP_MEMBER_TEMPLATES
  293.   template <class _InputIterator>
  294.   hash_multiset(_InputIterator __f, _InputIterator __l)
  295.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  296.     { _M_ht.insert_equal(__f, __l); }
  297.   template <class _InputIterator>
  298.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
  299.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  300.     { _M_ht.insert_equal(__f, __l); }
  301.   template <class _InputIterator>
  302.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
  303.                 const hasher& __hf)
  304.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  305.     { _M_ht.insert_equal(__f, __l); }
  306.  
  307. # ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
  308.   template <class _InputIterator>
  309.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
  310.                 const hasher& __hf, const key_equal& __eql)
  311.     : _M_ht(__n, __hf, __eql, allocator_type())
  312.     { _M_ht.insert_equal(__f, __l); }
  313. # endif
  314.   template <class _InputIterator>
  315.   hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
  316.                 const hasher& __hf, const key_equal& __eql,
  317.                 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
  318.     : _M_ht(__n, __hf, __eql, __a)
  319.     { _M_ht.insert_equal(__f, __l); }
  320. #else
  321.  
  322.   hash_multiset(const value_type* __f, const value_type* __l)
  323.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  324.     { _M_ht.insert_equal(__f, __l); }
  325.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
  326.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  327.     { _M_ht.insert_equal(__f, __l); }
  328.   hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
  329.                 const hasher& __hf)
  330.     : _M_ht(__n, __hf, 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.                 const hasher& __hf, const key_equal& __eql,
  334.                 const allocator_type& __a = allocator_type())
  335.     : _M_ht(__n, __hf, __eql, __a)
  336.     { _M_ht.insert_equal(__f, __l); }
  337.  
  338.   hash_multiset(const_iterator __f, const_iterator __l)
  339.     : _M_ht(100, hasher(), key_equal(), allocator_type())
  340.     { _M_ht.insert_equal(__f, __l); }
  341.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
  342.     : _M_ht(__n, hasher(), key_equal(), allocator_type())
  343.     { _M_ht.insert_equal(__f, __l); }
  344.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
  345.                 const hasher& __hf)
  346.     : _M_ht(__n, __hf, key_equal(), allocator_type())
  347.     { _M_ht.insert_equal(__f, __l); }
  348.   hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
  349.                 const hasher& __hf, const key_equal& __eql,
  350.                 const allocator_type& __a = allocator_type())
  351.     : _M_ht(__n, __hf, __eql, __a)
  352.     { _M_ht.insert_equal(__f, __l); }
  353. #endif /*_STLP_MEMBER_TEMPLATES */
  354.  
  355. public:
  356.   size_type size() const { return _M_ht.size(); }
  357.   size_type max_size() const { return _M_ht.max_size(); }
  358.   bool empty() const { return _M_ht.empty(); }
  359.   void swap(_Self& hs) { _M_ht.swap(hs._M_ht); }
  360.  
  361.   iterator begin() const { return _M_ht.begin(); }
  362.   iterator end() const { return _M_ht.end(); }
  363.  
  364. public:
  365.   iterator insert(const value_type& __obj)
  366.     { return _M_ht.insert_equal(__obj); }
  367. #ifdef _STLP_MEMBER_TEMPLATES
  368.   template <class _InputIterator>
  369.   void insert(_InputIterator __f, _InputIterator __l) 
  370.     { _M_ht.insert_equal(__f,__l); }
  371. #else
  372.   void insert(const value_type* __f, const value_type* __l) {
  373.     _M_ht.insert_equal(__f,__l);
  374.   }
  375.   void insert(const_iterator __f, const_iterator __l) 
  376.     { _M_ht.insert_equal(__f, __l); }
  377. #endif /*_STLP_MEMBER_TEMPLATES */
  378.   iterator insert_noresize(const value_type& __obj)
  379.     { return _M_ht.insert_equal_noresize(__obj); }    
  380.  
  381. # if defined(_STLP_MEMBER_TEMPLATES) && ! defined ( _STLP_NO_EXTENSIONS )
  382.   template <class _KT>
  383.   iterator find(const _KT& __key) const { return _M_ht.find(__key); }
  384. # else
  385.   iterator find(const key_type& __key) const { return _M_ht.find(__key); }
  386. # endif
  387.  
  388.   size_type count(const key_type& __key) const { return _M_ht.count(__key); }
  389.   
  390.   pair<iterator, iterator> equal_range(const key_type& __key) const
  391.     { return _M_ht.equal_range(__key); }
  392.  
  393.   size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
  394.   void erase(iterator __it) { _M_ht.erase(__it); }
  395.   void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
  396.   void clear() { _M_ht.clear(); }
  397.  
  398. public:
  399.   void resize(size_type __hint) { _M_ht.resize(__hint); }
  400.   size_type bucket_count() const { return _M_ht.bucket_count(); }
  401.   size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
  402.   size_type elems_in_bucket(size_type __n) const
  403.     { return _M_ht.elems_in_bucket(__n); }
  404.   static bool _STLP_CALL _M_equal (const _Self& __x, const _Self& __y) {
  405.     return _Ht::_M_equal(__x._M_ht,__y._M_ht);
  406.   }
  407. };
  408.  
  409. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  410. inline bool 
  411. operator==(const hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  412.            const hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
  413. {
  414.   return hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>::_M_equal(__hs1, __hs2);
  415. }
  416.  
  417. #ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE
  418.  
  419. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  420. inline bool _STLP_CALL 
  421. operator!=(const hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
  422.            const hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) {
  423.   return !(__hs1 == __hs2);
  424. }
  425.  
  426. template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
  427. inline void _STLP_CALL 
  428. swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
  429.      hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
  430.   __hs1.swap(__hs2);
  431. }
  432.  
  433. #endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
  434.  
  435. // Specialization of insert_iterator so that it will work for hash_set
  436. // and hash_multiset.
  437.  
  438. #ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
  439.  
  440. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  441. class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > {
  442. protected:
  443.   typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
  444.   _Container* container;
  445. public:
  446.   typedef _Container          container_type;
  447.   typedef output_iterator_tag iterator_category;
  448.   typedef void                value_type;
  449.   typedef void                difference_type;
  450.   typedef void                pointer;
  451.   typedef void                reference;
  452.  
  453.   insert_iterator(_Container& __x) : container(&__x) {}
  454.   insert_iterator(_Container& __x, typename _Container::iterator)
  455.     : container(&__x) {}
  456.   insert_iterator<_Container>&
  457.   operator=(const typename _Container::value_type& __val) { 
  458.     container->insert(__val);
  459.     return *this;
  460.   }
  461.   insert_iterator<_Container>& operator*() { return *this; }
  462.   insert_iterator<_Container>& operator++() { return *this; }
  463.   insert_iterator<_Container>& operator++(int) { return *this; }
  464. };
  465.  
  466. template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
  467. class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > {
  468. protected:
  469.   typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container;
  470.   _Container* container;
  471.   typename _Container::iterator iter;
  472. public:
  473.   typedef _Container          container_type;
  474.   typedef output_iterator_tag iterator_category;
  475.   typedef void                value_type;
  476.   typedef void                difference_type;
  477.   typedef void                pointer;
  478.   typedef void                reference;
  479.  
  480.   insert_iterator(_Container& __x) : container(&__x) {}
  481.   insert_iterator(_Container& __x, typename _Container::iterator)
  482.     : container(&__x) {}
  483.   insert_iterator<_Container>&
  484.   operator=(const typename _Container::value_type& __val) { 
  485.     container->insert(__val);
  486.     return *this;
  487.   }
  488.   insert_iterator<_Container>& operator*() { return *this; }
  489.   insert_iterator<_Container>& operator++() { return *this; }
  490.   insert_iterator<_Container>& operator++(int) { return *this; }
  491. };
  492.  
  493. #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
  494. _STLP_END_NAMESPACE
  495.  
  496. // do a cleanup
  497. #  undef hash_set
  498. #  undef hash_multiset
  499.  
  500. // provide a uniform way to access full funclionality 
  501. #  define __hash_set__       __FULL_NAME(hash_set)
  502. #  define __hash_multiset__  __FULL_NAME(hash_multiset)
  503.  
  504. # if defined ( _STLP_USE_WRAPPER_FOR_ALLOC_PARAM )
  505. #  include <stl/wrappers/_hash_set.h>
  506. # endif /*  WRAPPER */
  507.  
  508. #endif /* _STLP_INTERNAL_HASH_SET_H */
  509.  
  510. // Local Variables:
  511. // mode:C++
  512. // End:
  513.  
  514.