56 #ifndef _BACKWARD_HASH_SET 
   57 #define _BACKWARD_HASH_SET 1 
   59 #ifndef _GLIBCXX_PERMIT_BACKWARD_HASH 
   67 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 
   69 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   81   template<
class _Value, 
class _HashFcn  = hash<_Value>,
 
   82        class _EqualKey = equal_to<_Value>,
 
   83        class _Alloc = allocator<_Value> >
 
   87       __glibcxx_class_requires(_Value, _SGIAssignableConcept)
 
   88       __glibcxx_class_requires3(_HashFcn, 
size_t, _Value, _UnaryFunctionConcept)
 
   89       __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
 
   92       typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
 
   93             _EqualKey, _Alloc> _Ht;
 
   97       typedef typename _Ht::key_type key_type;
 
   98       typedef typename _Ht::value_type value_type;
 
   99       typedef typename _Ht::hasher hasher;
 
  100       typedef typename _Ht::key_equal key_equal;
 
  102       typedef typename _Ht::size_type size_type;
 
  103       typedef typename _Ht::difference_type difference_type;
 
  104       typedef typename _Alloc::pointer pointer;
 
  105       typedef typename _Alloc::const_pointer const_pointer;
 
  106       typedef typename _Alloc::reference reference;
 
  107       typedef typename _Alloc::const_reference const_reference;
 
  109       typedef typename _Ht::const_iterator iterator;
 
  110       typedef typename _Ht::const_iterator const_iterator;
 
  112       typedef typename _Ht::allocator_type allocator_type;
 
  116       { 
return _M_ht.hash_funct(); }
 
  120       { 
return _M_ht.key_eq(); }
 
  123       get_allocator()
 const 
  124       { 
return _M_ht.get_allocator(); }
 
  127       : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
 
  131       : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
 
  133       hash_set(size_type __n, 
const hasher& __hf)
 
  134       : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
 
  136       hash_set(size_type __n, 
const hasher& __hf, 
const key_equal& __eql,
 
  137            const allocator_type& __a = allocator_type())
 
  138       : _M_ht(__n, __hf, __eql, __a) {}
 
  140       template<
class _InputIterator>
 
  141         hash_set(_InputIterator __f, _InputIterator __l)
 
  142     : _M_ht(100, hasher(), key_equal(), allocator_type())
 
  143         { _M_ht.insert_unique(__f, __l); }
 
  145       template<
class _InputIterator>
 
  146         hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
 
  147     : _M_ht(__n, hasher(), key_equal(), allocator_type())
 
  148         { _M_ht.insert_unique(__f, __l); }
 
  150       template<
class _InputIterator>
 
  151         hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
 
  153     : _M_ht(__n, __hf, key_equal(), allocator_type())
 
  154         { _M_ht.insert_unique(__f, __l); }
 
  156       template<
class _InputIterator>
 
  157         hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
 
  158          const hasher& __hf, 
const key_equal& __eql,
 
  159          const allocator_type& __a = allocator_type())
 
  160     : _M_ht(__n, __hf, __eql, __a)
 
  161         { _M_ht.insert_unique(__f, __l); }
 
  165       { 
return _M_ht.size(); }
 
  169       { 
return _M_ht.max_size(); }
 
  173       { 
return _M_ht.empty(); }
 
  177       { _M_ht.swap(__hs._M_ht); }
 
  179       template<
class _Val, 
class _HF, 
class _EqK, 
class _Al>
 
  186       { 
return _M_ht.begin(); }
 
  190       { 
return _M_ht.end(); }
 
  193       insert(
const value_type& __obj)
 
  199       template<
class _InputIterator>
 
  201         insert(_InputIterator __f, _InputIterator __l)
 
  202         { _M_ht.insert_unique(__f, __l); }
 
  205       insert_noresize(
const value_type& __obj)
 
  208       = _M_ht.insert_unique_noresize(__obj);
 
  213       find(
const key_type& __key)
 const 
  214       { 
return _M_ht.find(__key); }
 
  217       count(
const key_type& __key)
 const 
  218       { 
return _M_ht.count(__key); }
 
  221       equal_range(
const key_type& __key)
 const 
  222       { 
return _M_ht.equal_range(__key); }
 
  225       erase(
const key_type& __key)
 
  226       {
return _M_ht.erase(__key); }
 
  230       { _M_ht.erase(__it); }
 
  233       erase(iterator __f, iterator __l)
 
  234       { _M_ht.erase(__f, __l); }
 
  241       resize(size_type __hint)
 
  242       { _M_ht.resize(__hint); }
 
  246       { 
return _M_ht.bucket_count(); }
 
  249       max_bucket_count()
 const 
  250       { 
return _M_ht.max_bucket_count(); }
 
  253       elems_in_bucket(size_type __n)
 const 
  254       { 
return _M_ht.elems_in_bucket(__n); }
 
  257   template<
class _Value, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  261     { 
return __hs1._M_ht == __hs2._M_ht; }
 
  263   template<
class _Value, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  265     operator!=(
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,
 
  266            const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)
 
  267     { 
return !(__hs1 == __hs2); }
 
  269   template<
class _Val, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  271     swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
 
  272      hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
 
  273     { __hs1.swap(__hs2); }
 
  281   template<
class _Value,
 
  282        class _HashFcn = hash<_Value>,
 
  283        class _EqualKey = equal_to<_Value>,
 
  284        class _Alloc = allocator<_Value> >
 
  288       __glibcxx_class_requires(_Value, _SGIAssignableConcept)
 
  289       __glibcxx_class_requires3(_HashFcn, 
size_t, _Value, _UnaryFunctionConcept)
 
  290       __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
 
  293       typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
 
  294             _EqualKey, _Alloc> _Ht;
 
  298       typedef typename _Ht::key_type key_type;
 
  299       typedef typename _Ht::value_type value_type;
 
  300       typedef typename _Ht::hasher hasher;
 
  301       typedef typename _Ht::key_equal key_equal;
 
  303       typedef typename _Ht::size_type size_type;
 
  304       typedef typename _Ht::difference_type difference_type;
 
  305       typedef typename _Alloc::pointer pointer;
 
  306       typedef typename _Alloc::const_pointer const_pointer;
 
  307       typedef typename _Alloc::reference reference;
 
  308       typedef typename _Alloc::const_reference const_reference;
 
  310       typedef typename _Ht::const_iterator iterator;
 
  311       typedef typename _Ht::const_iterator const_iterator;
 
  313       typedef typename _Ht::allocator_type allocator_type;
 
  317       { 
return _M_ht.hash_funct(); }
 
  321       { 
return _M_ht.key_eq(); }
 
  324       get_allocator()
 const 
  325       { 
return _M_ht.get_allocator(); }
 
  328       : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
 
  332       : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
 
  335       : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
 
  337       hash_multiset(size_type __n, 
const hasher& __hf, 
const key_equal& __eql,
 
  338             const allocator_type& __a = allocator_type())
 
  339       : _M_ht(__n, __hf, __eql, __a) {}
 
  341       template<
class _InputIterator>
 
  343     : _M_ht(100, hasher(), key_equal(), allocator_type())
 
  344         { _M_ht.insert_equal(__f, __l); }
 
  346       template<
class _InputIterator>
 
  347         hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
 
  348     : _M_ht(__n, hasher(), key_equal(), allocator_type())
 
  349         { _M_ht.insert_equal(__f, __l); }
 
  351       template<
class _InputIterator>
 
  352         hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
 
  354     : _M_ht(__n, __hf, key_equal(), allocator_type())
 
  355         { _M_ht.insert_equal(__f, __l); }
 
  357       template<
class _InputIterator>
 
  358         hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
 
  359               const hasher& __hf, 
const key_equal& __eql,
 
  360               const allocator_type& __a = allocator_type())
 
  361     : _M_ht(__n, __hf, __eql, __a)
 
  362         { _M_ht.insert_equal(__f, __l); }
 
  366       { 
return _M_ht.size(); }
 
  370       { 
return _M_ht.max_size(); }
 
  374       { 
return _M_ht.empty(); }
 
  378       { _M_ht.swap(hs._M_ht); }
 
  380       template<
class _Val, 
class _HF, 
class _EqK, 
class _Al>
 
  387       { 
return _M_ht.begin(); }
 
  391       { 
return _M_ht.end(); }
 
  394       insert(
const value_type& __obj)
 
  395       { 
return _M_ht.insert_equal(__obj); }
 
  397       template<
class _InputIterator>
 
  399         insert(_InputIterator __f, _InputIterator __l)
 
  400         { _M_ht.insert_equal(__f,__l); }
 
  403       insert_noresize(
const value_type& __obj)
 
  404       { 
return _M_ht.insert_equal_noresize(__obj); }
 
  407       find(
const key_type& __key)
 const 
  408       { 
return _M_ht.find(__key); }
 
  411       count(
const key_type& __key)
 const 
  412       { 
return _M_ht.count(__key); }
 
  415       equal_range(
const key_type& __key)
 const 
  416       { 
return _M_ht.equal_range(__key); }
 
  419       erase(
const key_type& __key)
 
  420       { 
return _M_ht.erase(__key); }
 
  424       { _M_ht.erase(__it); }
 
  427       erase(iterator __f, iterator __l)
 
  428       { _M_ht.erase(__f, __l); }
 
  435       resize(size_type __hint)
 
  436       { _M_ht.resize(__hint); }
 
  440       { 
return _M_ht.bucket_count(); }
 
  443       max_bucket_count()
 const 
  444       { 
return _M_ht.max_bucket_count(); }
 
  447       elems_in_bucket(size_type __n)
 const 
  448       { 
return _M_ht.elems_in_bucket(__n); }
 
  451   template<
class _Val, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  455     { 
return __hs1._M_ht == __hs2._M_ht; }
 
  457   template<
class _Val, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  459     operator!=(
const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
 
  460            const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
 
  461     { 
return !(__hs1 == __hs2); }
 
  463   template<
class _Val, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  465     swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,
 
  466      hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)
 
  467     { __hs1.swap(__hs2); }
 
  469 _GLIBCXX_END_NAMESPACE_VERSION
 
  472 namespace std _GLIBCXX_VISIBILITY(default)
 
  474 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
  478   template<
class _Value, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  479     class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,
 
  485       _Container* container;
 
  501       insert_iterator<_Container>&
 
  502       operator=(
const typename _Container::value_type& __value)
 
  504     container->insert(__value);
 
  508       insert_iterator<_Container>&
 
  512       insert_iterator<_Container>&
 
  516       insert_iterator<_Container>&
 
  521   template<
class _Value, 
class _HashFcn, 
class _EqualKey, 
class _Alloc>
 
  522     class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,
 
  528       _Container* container;
 
  529       typename _Container::iterator iter;
 
  545       insert_iterator<_Container>&
 
  546       operator=(
const typename _Container::value_type& __value)
 
  548     container->insert(__value);
 
  552       insert_iterator<_Container>&
 
  556       insert_iterator<_Container>&
 
  560       insert_iterator<_Container>&
 
  564 _GLIBCXX_END_NAMESPACE_VERSION
 
_T2 second
first is a copy of the first object 
 
output_iterator_tag iterator_category
One of the tag types. 
 
_T1 first
second_type is the second bound type 
 
Struct holding two objects of arbitrary type. 
 
void reference
This type represents a reference-to-value_type. 
 
insert_iterator & operator=(const typename _Container::value_type &__value)
 
_Container container_type
A nested typedef for the type of whatever container you used. 
 
insert_iterator & operator*()
Simply returns *this. 
 
void value_type
The type "pointed to" by the iterator. 
 
insert_iterator & operator++()
Simply returns *this. (This iterator does not move.) 
 
The standard allocator, as per [20.4]. 
 
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers. 
 
One of the comparison functors. 
 
void pointer
This type represents a pointer-to-value_type. 
 
void difference_type
Distance between iterators is represented as this type. 
 
insert_iterator(_Container &__x, typename _Container::iterator __i)