xref: /dflybsd-src/contrib/gcc-8.0/libstdc++-v3/include/backward/hash_set (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj// Hashing set implementation -*- C++ -*-
2*38fd1498Szrj
3*38fd1498Szrj// Copyright (C) 2001-2018 Free Software Foundation, Inc.
4*38fd1498Szrj//
5*38fd1498Szrj// This file is part of the GNU ISO C++ Library.  This library is free
6*38fd1498Szrj// software; you can redistribute it and/or modify it under the
7*38fd1498Szrj// terms of the GNU General Public License as published by the
8*38fd1498Szrj// Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj// any later version.
10*38fd1498Szrj
11*38fd1498Szrj// This library is distributed in the hope that it will be useful,
12*38fd1498Szrj// but WITHOUT ANY WARRANTY; without even the implied warranty of
13*38fd1498Szrj// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*38fd1498Szrj// GNU General Public License for more details.
15*38fd1498Szrj
16*38fd1498Szrj// Under Section 7 of GPL version 3, you are granted additional
17*38fd1498Szrj// permissions described in the GCC Runtime Library Exception, version
18*38fd1498Szrj// 3.1, as published by the Free Software Foundation.
19*38fd1498Szrj
20*38fd1498Szrj// You should have received a copy of the GNU General Public License and
21*38fd1498Szrj// a copy of the GCC Runtime Library Exception along with this program;
22*38fd1498Szrj// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23*38fd1498Szrj// <http://www.gnu.org/licenses/>.
24*38fd1498Szrj
25*38fd1498Szrj/*
26*38fd1498Szrj * Copyright (c) 1996
27*38fd1498Szrj * Silicon Graphics Computer Systems, Inc.
28*38fd1498Szrj *
29*38fd1498Szrj * Permission to use, copy, modify, distribute and sell this software
30*38fd1498Szrj * and its documentation for any purpose is hereby granted without fee,
31*38fd1498Szrj * provided that the above copyright notice appear in all copies and
32*38fd1498Szrj * that both that copyright notice and this permission notice appear
33*38fd1498Szrj * in supporting documentation.  Silicon Graphics makes no
34*38fd1498Szrj * representations about the suitability of this software for any
35*38fd1498Szrj * purpose.  It is provided "as is" without express or implied warranty.
36*38fd1498Szrj *
37*38fd1498Szrj *
38*38fd1498Szrj * Copyright (c) 1994
39*38fd1498Szrj * Hewlett-Packard Company
40*38fd1498Szrj *
41*38fd1498Szrj * Permission to use, copy, modify, distribute and sell this software
42*38fd1498Szrj * and its documentation for any purpose is hereby granted without fee,
43*38fd1498Szrj * provided that the above copyright notice appear in all copies and
44*38fd1498Szrj * that both that copyright notice and this permission notice appear
45*38fd1498Szrj * in supporting documentation.  Hewlett-Packard Company makes no
46*38fd1498Szrj * representations about the suitability of this software for any
47*38fd1498Szrj * purpose.  It is provided "as is" without express or implied warranty.
48*38fd1498Szrj *
49*38fd1498Szrj */
50*38fd1498Szrj
51*38fd1498Szrj/** @file backward/hash_set
52*38fd1498Szrj *  This file is a GNU extension to the Standard C++ Library (possibly
53*38fd1498Szrj *  containing extensions from the HP/SGI STL subset).
54*38fd1498Szrj */
55*38fd1498Szrj
56*38fd1498Szrj#ifndef _BACKWARD_HASH_SET
57*38fd1498Szrj#define _BACKWARD_HASH_SET 1
58*38fd1498Szrj
59*38fd1498Szrj#ifndef _GLIBCXX_PERMIT_BACKWARD_HASH
60*38fd1498Szrj#include "backward_warning.h"
61*38fd1498Szrj#endif
62*38fd1498Szrj
63*38fd1498Szrj#include <bits/c++config.h>
64*38fd1498Szrj#include <backward/hashtable.h>
65*38fd1498Szrj#include <bits/concept_check.h>
66*38fd1498Szrj
67*38fd1498Szrjnamespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
68*38fd1498Szrj{
69*38fd1498Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
70*38fd1498Szrj
71*38fd1498Szrj  using std::equal_to;
72*38fd1498Szrj  using std::allocator;
73*38fd1498Szrj  using std::pair;
74*38fd1498Szrj  using std::_Identity;
75*38fd1498Szrj
76*38fd1498Szrj  /**
77*38fd1498Szrj   *  This is an SGI extension.
78*38fd1498Szrj   *  @ingroup SGIextensions
79*38fd1498Szrj   *  @doctodo
80*38fd1498Szrj   */
81*38fd1498Szrj  template<class _Value, class _HashFcn  = hash<_Value>,
82*38fd1498Szrj	   class _EqualKey = equal_to<_Value>,
83*38fd1498Szrj	   class _Alloc = allocator<_Value> >
84*38fd1498Szrj    class hash_set
85*38fd1498Szrj    {
86*38fd1498Szrj      // concept requirements
87*38fd1498Szrj      __glibcxx_class_requires(_Value, _SGIAssignableConcept)
88*38fd1498Szrj      __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
89*38fd1498Szrj      __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
90*38fd1498Szrj
91*38fd1498Szrj    private:
92*38fd1498Szrj      typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
93*38fd1498Szrj			_EqualKey, _Alloc> _Ht;
94*38fd1498Szrj      _Ht _M_ht;
95*38fd1498Szrj
96*38fd1498Szrj    public:
97*38fd1498Szrj      typedef typename _Ht::key_type key_type;
98*38fd1498Szrj      typedef typename _Ht::value_type value_type;
99*38fd1498Szrj      typedef typename _Ht::hasher hasher;
100*38fd1498Szrj      typedef typename _Ht::key_equal key_equal;
101*38fd1498Szrj
102*38fd1498Szrj      typedef typename _Ht::size_type size_type;
103*38fd1498Szrj      typedef typename _Ht::difference_type difference_type;
104*38fd1498Szrj      typedef typename _Alloc::pointer pointer;
105*38fd1498Szrj      typedef typename _Alloc::const_pointer const_pointer;
106*38fd1498Szrj      typedef typename _Alloc::reference reference;
107*38fd1498Szrj      typedef typename _Alloc::const_reference const_reference;
108*38fd1498Szrj
109*38fd1498Szrj      typedef typename _Ht::const_iterator iterator;
110*38fd1498Szrj      typedef typename _Ht::const_iterator const_iterator;
111*38fd1498Szrj
112*38fd1498Szrj      typedef typename _Ht::allocator_type allocator_type;
113*38fd1498Szrj
114*38fd1498Szrj      hasher
115*38fd1498Szrj      hash_funct() const
116*38fd1498Szrj      { return _M_ht.hash_funct(); }
117*38fd1498Szrj
118*38fd1498Szrj      key_equal
119*38fd1498Szrj      key_eq() const
120*38fd1498Szrj      { return _M_ht.key_eq(); }
121*38fd1498Szrj
122*38fd1498Szrj      allocator_type
123*38fd1498Szrj      get_allocator() const
124*38fd1498Szrj      { return _M_ht.get_allocator(); }
125*38fd1498Szrj
126*38fd1498Szrj      hash_set()
127*38fd1498Szrj      : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
128*38fd1498Szrj
129*38fd1498Szrj      explicit
130*38fd1498Szrj      hash_set(size_type __n)
131*38fd1498Szrj      : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
132*38fd1498Szrj
133*38fd1498Szrj      hash_set(size_type __n, const hasher& __hf)
134*38fd1498Szrj      : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
135*38fd1498Szrj
136*38fd1498Szrj      hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
137*38fd1498Szrj	       const allocator_type& __a = allocator_type())
138*38fd1498Szrj      : _M_ht(__n, __hf, __eql, __a) {}
139*38fd1498Szrj
140*38fd1498Szrj      template<class _InputIterator>
141*38fd1498Szrj        hash_set(_InputIterator __f, _InputIterator __l)
142*38fd1498Szrj	: _M_ht(100, hasher(), key_equal(), allocator_type())
143*38fd1498Szrj        { _M_ht.insert_unique(__f, __l); }
144*38fd1498Szrj
145*38fd1498Szrj      template<class _InputIterator>
146*38fd1498Szrj        hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
147*38fd1498Szrj	: _M_ht(__n, hasher(), key_equal(), allocator_type())
148*38fd1498Szrj        { _M_ht.insert_unique(__f, __l); }
149*38fd1498Szrj
150*38fd1498Szrj      template<class _InputIterator>
151*38fd1498Szrj        hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
152*38fd1498Szrj		 const hasher& __hf)
153*38fd1498Szrj	: _M_ht(__n, __hf, key_equal(), allocator_type())
154*38fd1498Szrj        { _M_ht.insert_unique(__f, __l); }
155*38fd1498Szrj
156*38fd1498Szrj      template<class _InputIterator>
157*38fd1498Szrj        hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
158*38fd1498Szrj		 const hasher& __hf, const key_equal& __eql,
159*38fd1498Szrj		 const allocator_type& __a = allocator_type())
160*38fd1498Szrj	: _M_ht(__n, __hf, __eql, __a)
161*38fd1498Szrj        { _M_ht.insert_unique(__f, __l); }
162*38fd1498Szrj
163*38fd1498Szrj      size_type
164*38fd1498Szrj      size() const
165*38fd1498Szrj      { return _M_ht.size(); }
166*38fd1498Szrj
167*38fd1498Szrj      size_type
168*38fd1498Szrj      max_size() const
169*38fd1498Szrj      { return _M_ht.max_size(); }
170*38fd1498Szrj
171*38fd1498Szrj      bool
172*38fd1498Szrj      empty() const
173*38fd1498Szrj      { return _M_ht.empty(); }
174*38fd1498Szrj
175*38fd1498Szrj      void
176*38fd1498Szrj      swap(hash_set& __hs)
177*38fd1498Szrj      { _M_ht.swap(__hs._M_ht); }
178*38fd1498Szrj
179*38fd1498Szrj      template<class _Val, class _HF, class _EqK, class _Al>
180*38fd1498Szrj        friend bool
181*38fd1498Szrj        operator==(const hash_set<_Val, _HF, _EqK, _Al>&,
182*38fd1498Szrj		   const hash_set<_Val, _HF, _EqK, _Al>&);
183*38fd1498Szrj
184*38fd1498Szrj      iterator
185*38fd1498Szrj      begin() const
186*38fd1498Szrj      { return _M_ht.begin(); }
187*38fd1498Szrj
188*38fd1498Szrj      iterator
189*38fd1498Szrj      end() const
190*38fd1498Szrj      { return _M_ht.end(); }
191*38fd1498Szrj
192*38fd1498Szrj      pair<iterator, bool>
193*38fd1498Szrj      insert(const value_type& __obj)
194*38fd1498Szrj      {
195*38fd1498Szrj	pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
196*38fd1498Szrj	return pair<iterator,bool>(__p.first, __p.second);
197*38fd1498Szrj      }
198*38fd1498Szrj
199*38fd1498Szrj      template<class _InputIterator>
200*38fd1498Szrj        void
201*38fd1498Szrj        insert(_InputIterator __f, _InputIterator __l)
202*38fd1498Szrj        { _M_ht.insert_unique(__f, __l); }
203*38fd1498Szrj
204*38fd1498Szrj      pair<iterator, bool>
205*38fd1498Szrj      insert_noresize(const value_type& __obj)
206*38fd1498Szrj      {
207*38fd1498Szrj	pair<typename _Ht::iterator, bool> __p
208*38fd1498Szrj	  = _M_ht.insert_unique_noresize(__obj);
209*38fd1498Szrj	return pair<iterator, bool>(__p.first, __p.second);
210*38fd1498Szrj      }
211*38fd1498Szrj
212*38fd1498Szrj      iterator
213*38fd1498Szrj      find(const key_type& __key) const
214*38fd1498Szrj      { return _M_ht.find(__key); }
215*38fd1498Szrj
216*38fd1498Szrj      size_type
217*38fd1498Szrj      count(const key_type& __key) const
218*38fd1498Szrj      { return _M_ht.count(__key); }
219*38fd1498Szrj
220*38fd1498Szrj      pair<iterator, iterator>
221*38fd1498Szrj      equal_range(const key_type& __key) const
222*38fd1498Szrj      { return _M_ht.equal_range(__key); }
223*38fd1498Szrj
224*38fd1498Szrj      size_type
225*38fd1498Szrj      erase(const key_type& __key)
226*38fd1498Szrj      {return _M_ht.erase(__key); }
227*38fd1498Szrj
228*38fd1498Szrj      void
229*38fd1498Szrj      erase(iterator __it)
230*38fd1498Szrj      { _M_ht.erase(__it); }
231*38fd1498Szrj
232*38fd1498Szrj      void
233*38fd1498Szrj      erase(iterator __f, iterator __l)
234*38fd1498Szrj      { _M_ht.erase(__f, __l); }
235*38fd1498Szrj
236*38fd1498Szrj      void
237*38fd1498Szrj      clear()
238*38fd1498Szrj      { _M_ht.clear(); }
239*38fd1498Szrj
240*38fd1498Szrj      void
241*38fd1498Szrj      resize(size_type __hint)
242*38fd1498Szrj      { _M_ht.resize(__hint); }
243*38fd1498Szrj
244*38fd1498Szrj      size_type
245*38fd1498Szrj      bucket_count() const
246*38fd1498Szrj      { return _M_ht.bucket_count(); }
247*38fd1498Szrj
248*38fd1498Szrj      size_type
249*38fd1498Szrj      max_bucket_count() const
250*38fd1498Szrj      { return _M_ht.max_bucket_count(); }
251*38fd1498Szrj
252*38fd1498Szrj      size_type
253*38fd1498Szrj      elems_in_bucket(size_type __n) const
254*38fd1498Szrj      { return _M_ht.elems_in_bucket(__n); }
255*38fd1498Szrj    };
256*38fd1498Szrj
257*38fd1498Szrj  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
258*38fd1498Szrj    inline bool
259*38fd1498Szrj    operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
260*38fd1498Szrj	       const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
261*38fd1498Szrj    { return __hs1._M_ht == __hs2._M_ht; }
262*38fd1498Szrj
263*38fd1498Szrj  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
264*38fd1498Szrj    inline bool
265*38fd1498Szrj    operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
266*38fd1498Szrj	       const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
267*38fd1498Szrj    { return !(__hs1 == __hs2); }
268*38fd1498Szrj
269*38fd1498Szrj  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
270*38fd1498Szrj    inline void
271*38fd1498Szrj    swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
272*38fd1498Szrj	 hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
273*38fd1498Szrj    { __hs1.swap(__hs2); }
274*38fd1498Szrj
275*38fd1498Szrj
276*38fd1498Szrj  /**
277*38fd1498Szrj   *  This is an SGI extension.
278*38fd1498Szrj   *  @ingroup SGIextensions
279*38fd1498Szrj   *  @doctodo
280*38fd1498Szrj   */
281*38fd1498Szrj  template<class _Value,
282*38fd1498Szrj	   class _HashFcn = hash<_Value>,
283*38fd1498Szrj	   class _EqualKey = equal_to<_Value>,
284*38fd1498Szrj	   class _Alloc = allocator<_Value> >
285*38fd1498Szrj    class hash_multiset
286*38fd1498Szrj    {
287*38fd1498Szrj      // concept requirements
288*38fd1498Szrj      __glibcxx_class_requires(_Value, _SGIAssignableConcept)
289*38fd1498Szrj      __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)
290*38fd1498Szrj      __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
291*38fd1498Szrj
292*38fd1498Szrj    private:
293*38fd1498Szrj      typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
294*38fd1498Szrj			_EqualKey, _Alloc> _Ht;
295*38fd1498Szrj      _Ht _M_ht;
296*38fd1498Szrj
297*38fd1498Szrj    public:
298*38fd1498Szrj      typedef typename _Ht::key_type key_type;
299*38fd1498Szrj      typedef typename _Ht::value_type value_type;
300*38fd1498Szrj      typedef typename _Ht::hasher hasher;
301*38fd1498Szrj      typedef typename _Ht::key_equal key_equal;
302*38fd1498Szrj
303*38fd1498Szrj      typedef typename _Ht::size_type size_type;
304*38fd1498Szrj      typedef typename _Ht::difference_type difference_type;
305*38fd1498Szrj      typedef typename _Alloc::pointer pointer;
306*38fd1498Szrj      typedef typename _Alloc::const_pointer const_pointer;
307*38fd1498Szrj      typedef typename _Alloc::reference reference;
308*38fd1498Szrj      typedef typename _Alloc::const_reference const_reference;
309*38fd1498Szrj
310*38fd1498Szrj      typedef typename _Ht::const_iterator iterator;
311*38fd1498Szrj      typedef typename _Ht::const_iterator const_iterator;
312*38fd1498Szrj
313*38fd1498Szrj      typedef typename _Ht::allocator_type allocator_type;
314*38fd1498Szrj
315*38fd1498Szrj      hasher
316*38fd1498Szrj      hash_funct() const
317*38fd1498Szrj      { return _M_ht.hash_funct(); }
318*38fd1498Szrj
319*38fd1498Szrj      key_equal
320*38fd1498Szrj      key_eq() const
321*38fd1498Szrj      { return _M_ht.key_eq(); }
322*38fd1498Szrj
323*38fd1498Szrj      allocator_type
324*38fd1498Szrj      get_allocator() const
325*38fd1498Szrj      { return _M_ht.get_allocator(); }
326*38fd1498Szrj
327*38fd1498Szrj      hash_multiset()
328*38fd1498Szrj      : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
329*38fd1498Szrj
330*38fd1498Szrj      explicit
331*38fd1498Szrj      hash_multiset(size_type __n)
332*38fd1498Szrj      : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
333*38fd1498Szrj
334*38fd1498Szrj      hash_multiset(size_type __n, const hasher& __hf)
335*38fd1498Szrj      : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
336*38fd1498Szrj
337*38fd1498Szrj      hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
338*38fd1498Szrj		    const allocator_type& __a = allocator_type())
339*38fd1498Szrj      : _M_ht(__n, __hf, __eql, __a) {}
340*38fd1498Szrj
341*38fd1498Szrj      template<class _InputIterator>
342*38fd1498Szrj        hash_multiset(_InputIterator __f, _InputIterator __l)
343*38fd1498Szrj	: _M_ht(100, hasher(), key_equal(), allocator_type())
344*38fd1498Szrj        { _M_ht.insert_equal(__f, __l); }
345*38fd1498Szrj
346*38fd1498Szrj      template<class _InputIterator>
347*38fd1498Szrj        hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
348*38fd1498Szrj	: _M_ht(__n, hasher(), key_equal(), allocator_type())
349*38fd1498Szrj        { _M_ht.insert_equal(__f, __l); }
350*38fd1498Szrj
351*38fd1498Szrj      template<class _InputIterator>
352*38fd1498Szrj        hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
353*38fd1498Szrj		      const hasher& __hf)
354*38fd1498Szrj	: _M_ht(__n, __hf, key_equal(), allocator_type())
355*38fd1498Szrj        { _M_ht.insert_equal(__f, __l); }
356*38fd1498Szrj
357*38fd1498Szrj      template<class _InputIterator>
358*38fd1498Szrj        hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
359*38fd1498Szrj		      const hasher& __hf, const key_equal& __eql,
360*38fd1498Szrj		      const allocator_type& __a = allocator_type())
361*38fd1498Szrj	: _M_ht(__n, __hf, __eql, __a)
362*38fd1498Szrj        { _M_ht.insert_equal(__f, __l); }
363*38fd1498Szrj
364*38fd1498Szrj      size_type
365*38fd1498Szrj      size() const
366*38fd1498Szrj      { return _M_ht.size(); }
367*38fd1498Szrj
368*38fd1498Szrj      size_type
369*38fd1498Szrj      max_size() const
370*38fd1498Szrj      { return _M_ht.max_size(); }
371*38fd1498Szrj
372*38fd1498Szrj      bool
373*38fd1498Szrj      empty() const
374*38fd1498Szrj      { return _M_ht.empty(); }
375*38fd1498Szrj
376*38fd1498Szrj      void
377*38fd1498Szrj      swap(hash_multiset& hs)
378*38fd1498Szrj      { _M_ht.swap(hs._M_ht); }
379*38fd1498Szrj
380*38fd1498Szrj      template<class _Val, class _HF, class _EqK, class _Al>
381*38fd1498Szrj        friend bool
382*38fd1498Szrj        operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&,
383*38fd1498Szrj		   const hash_multiset<_Val, _HF, _EqK, _Al>&);
384*38fd1498Szrj
385*38fd1498Szrj      iterator
386*38fd1498Szrj      begin() const
387*38fd1498Szrj      { return _M_ht.begin(); }
388*38fd1498Szrj
389*38fd1498Szrj      iterator
390*38fd1498Szrj      end() const
391*38fd1498Szrj      { return _M_ht.end(); }
392*38fd1498Szrj
393*38fd1498Szrj      iterator
394*38fd1498Szrj      insert(const value_type& __obj)
395*38fd1498Szrj      { return _M_ht.insert_equal(__obj); }
396*38fd1498Szrj
397*38fd1498Szrj      template<class _InputIterator>
398*38fd1498Szrj        void
399*38fd1498Szrj        insert(_InputIterator __f, _InputIterator __l)
400*38fd1498Szrj        { _M_ht.insert_equal(__f,__l); }
401*38fd1498Szrj
402*38fd1498Szrj      iterator
403*38fd1498Szrj      insert_noresize(const value_type& __obj)
404*38fd1498Szrj      { return _M_ht.insert_equal_noresize(__obj); }
405*38fd1498Szrj
406*38fd1498Szrj      iterator
407*38fd1498Szrj      find(const key_type& __key) const
408*38fd1498Szrj      { return _M_ht.find(__key); }
409*38fd1498Szrj
410*38fd1498Szrj      size_type
411*38fd1498Szrj      count(const key_type& __key) const
412*38fd1498Szrj      { return _M_ht.count(__key); }
413*38fd1498Szrj
414*38fd1498Szrj      pair<iterator, iterator>
415*38fd1498Szrj      equal_range(const key_type& __key) const
416*38fd1498Szrj      { return _M_ht.equal_range(__key); }
417*38fd1498Szrj
418*38fd1498Szrj      size_type
419*38fd1498Szrj      erase(const key_type& __key)
420*38fd1498Szrj      { return _M_ht.erase(__key); }
421*38fd1498Szrj
422*38fd1498Szrj      void
423*38fd1498Szrj      erase(iterator __it)
424*38fd1498Szrj      { _M_ht.erase(__it); }
425*38fd1498Szrj
426*38fd1498Szrj      void
427*38fd1498Szrj      erase(iterator __f, iterator __l)
428*38fd1498Szrj      { _M_ht.erase(__f, __l); }
429*38fd1498Szrj
430*38fd1498Szrj      void
431*38fd1498Szrj      clear()
432*38fd1498Szrj      { _M_ht.clear(); }
433*38fd1498Szrj
434*38fd1498Szrj      void
435*38fd1498Szrj      resize(size_type __hint)
436*38fd1498Szrj      { _M_ht.resize(__hint); }
437*38fd1498Szrj
438*38fd1498Szrj      size_type
439*38fd1498Szrj      bucket_count() const
440*38fd1498Szrj      { return _M_ht.bucket_count(); }
441*38fd1498Szrj
442*38fd1498Szrj      size_type
443*38fd1498Szrj      max_bucket_count() const
444*38fd1498Szrj      { return _M_ht.max_bucket_count(); }
445*38fd1498Szrj
446*38fd1498Szrj      size_type
447*38fd1498Szrj      elems_in_bucket(size_type __n) const
448*38fd1498Szrj      { return _M_ht.elems_in_bucket(__n); }
449*38fd1498Szrj    };
450*38fd1498Szrj
451*38fd1498Szrj  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
452*38fd1498Szrj    inline bool
453*38fd1498Szrj    operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
454*38fd1498Szrj	       const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
455*38fd1498Szrj    { return __hs1._M_ht == __hs2._M_ht; }
456*38fd1498Szrj
457*38fd1498Szrj  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
458*38fd1498Szrj    inline bool
459*38fd1498Szrj    operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
460*38fd1498Szrj	       const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
461*38fd1498Szrj    { return !(__hs1 == __hs2); }
462*38fd1498Szrj
463*38fd1498Szrj  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>
464*38fd1498Szrj    inline void
465*38fd1498Szrj    swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
466*38fd1498Szrj	 hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
467*38fd1498Szrj    { __hs1.swap(__hs2); }
468*38fd1498Szrj
469*38fd1498Szrj_GLIBCXX_END_NAMESPACE_VERSION
470*38fd1498Szrj} // namespace
471*38fd1498Szrj
472*38fd1498Szrjnamespace std _GLIBCXX_VISIBILITY(default)
473*38fd1498Szrj{
474*38fd1498Szrj_GLIBCXX_BEGIN_NAMESPACE_VERSION
475*38fd1498Szrj
476*38fd1498Szrj  // Specialization of insert_iterator so that it will work for hash_set
477*38fd1498Szrj  // and hash_multiset.
478*38fd1498Szrj  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
479*38fd1498Szrj    class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,
480*38fd1498Szrj					      _EqualKey, _Alloc> >
481*38fd1498Szrj    {
482*38fd1498Szrj    protected:
483*38fd1498Szrj      typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>
484*38fd1498Szrj        _Container;
485*38fd1498Szrj      _Container* container;
486*38fd1498Szrj
487*38fd1498Szrj    public:
488*38fd1498Szrj      typedef _Container          container_type;
489*38fd1498Szrj      typedef output_iterator_tag iterator_category;
490*38fd1498Szrj      typedef void                value_type;
491*38fd1498Szrj      typedef void                difference_type;
492*38fd1498Szrj      typedef void                pointer;
493*38fd1498Szrj      typedef void                reference;
494*38fd1498Szrj
495*38fd1498Szrj      insert_iterator(_Container& __x)
496*38fd1498Szrj      : container(&__x) {}
497*38fd1498Szrj
498*38fd1498Szrj      insert_iterator(_Container& __x, typename _Container::iterator)
499*38fd1498Szrj      : container(&__x) {}
500*38fd1498Szrj
501*38fd1498Szrj      insert_iterator<_Container>&
502*38fd1498Szrj      operator=(const typename _Container::value_type& __value)
503*38fd1498Szrj      {
504*38fd1498Szrj	container->insert(__value);
505*38fd1498Szrj	return *this;
506*38fd1498Szrj      }
507*38fd1498Szrj
508*38fd1498Szrj      insert_iterator<_Container>&
509*38fd1498Szrj      operator*()
510*38fd1498Szrj      { return *this; }
511*38fd1498Szrj
512*38fd1498Szrj      insert_iterator<_Container>&
513*38fd1498Szrj      operator++()
514*38fd1498Szrj      { return *this; }
515*38fd1498Szrj
516*38fd1498Szrj      insert_iterator<_Container>&
517*38fd1498Szrj      operator++(int)
518*38fd1498Szrj      { return *this; }
519*38fd1498Szrj    };
520*38fd1498Szrj
521*38fd1498Szrj  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>
522*38fd1498Szrj    class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,
523*38fd1498Szrj						   _EqualKey, _Alloc> >
524*38fd1498Szrj    {
525*38fd1498Szrj    protected:
526*38fd1498Szrj      typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>
527*38fd1498Szrj        _Container;
528*38fd1498Szrj      _Container* container;
529*38fd1498Szrj      typename _Container::iterator iter;
530*38fd1498Szrj
531*38fd1498Szrj    public:
532*38fd1498Szrj      typedef _Container          container_type;
533*38fd1498Szrj      typedef output_iterator_tag iterator_category;
534*38fd1498Szrj      typedef void                value_type;
535*38fd1498Szrj      typedef void                difference_type;
536*38fd1498Szrj      typedef void                pointer;
537*38fd1498Szrj      typedef void                reference;
538*38fd1498Szrj
539*38fd1498Szrj      insert_iterator(_Container& __x)
540*38fd1498Szrj      : container(&__x) {}
541*38fd1498Szrj
542*38fd1498Szrj      insert_iterator(_Container& __x, typename _Container::iterator)
543*38fd1498Szrj      : container(&__x) {}
544*38fd1498Szrj
545*38fd1498Szrj      insert_iterator<_Container>&
546*38fd1498Szrj      operator=(const typename _Container::value_type& __value)
547*38fd1498Szrj      {
548*38fd1498Szrj	container->insert(__value);
549*38fd1498Szrj	return *this;
550*38fd1498Szrj      }
551*38fd1498Szrj
552*38fd1498Szrj      insert_iterator<_Container>&
553*38fd1498Szrj      operator*()
554*38fd1498Szrj      { return *this; }
555*38fd1498Szrj
556*38fd1498Szrj      insert_iterator<_Container>&
557*38fd1498Szrj      operator++()
558*38fd1498Szrj      { return *this; }
559*38fd1498Szrj
560*38fd1498Szrj      insert_iterator<_Container>&
561*38fd1498Szrj      operator++(int) { return *this; }
562*38fd1498Szrj    };
563*38fd1498Szrj
564*38fd1498Szrj_GLIBCXX_END_NAMESPACE_VERSION
565*38fd1498Szrj} // namespace
566*38fd1498Szrj
567*38fd1498Szrj#endif
568