19720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/*
29720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Copyright (c) 2004
39720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Francois Dumont
49720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
59720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * This material is provided "as is", with absolutely no warranty expressed
69720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * or implied. Any use is at your own risk.
79720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
89720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to use or copy this software for any purpose is hereby granted
99720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * without fee, provided the above notices are retained on all copies.
109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * Permission to modify the code and to distribute modified code is granted,
119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * provided the above notices are retained, and a notice that the code was
129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block * modified is included with the above copyright notice.
139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *
149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block/* NOTE: This is an internal header file, included by other STL headers.
179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block *   You should not attempt to use it directly.
189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block */
199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_UNORDERED_MAP_H
219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_INTERNAL_UNORDERED_MAP_H
229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#ifndef _STLP_INTERNAL_HASHTABLE_H
249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#  include <stl/_hashtable.h>
259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_BEGIN_NAMESPACE
289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block//Specific iterator traits creation
309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, traits)
319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
32e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_BEGIN_TR1_NAMESPACE
33e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
35e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott          _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>),
36e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott          _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass unordered_map
389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block               : public __stlport_class<unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{
429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Key key_type;
469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Tp data_type;
479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Tp mapped_type;
48e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  typedef pair<_STLP_CONST key_type, data_type> value_type;
499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  //Specific iterator traits creation
519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV _UnorderedMapTraitsT<value_type> _UnorderedMapTraits;
529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMapTraits,
559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                    _STLP_SELECT1ST(value_type,  _Key), _EqualKey, _Alloc > _Ht;
569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::hasher hasher;
589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::key_equal key_equal;
599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::size_type size_type;
619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::difference_type difference_type;
629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::pointer pointer;
639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_pointer const_pointer;
649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::reference reference;
659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_reference const_reference;
669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::iterator iterator;
689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_iterator const_iterator;
699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::local_iterator local_iterator;
709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_local_iterator const_local_iterator;
719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::allocator_type allocator_type;
739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  hasher hash_function() const { return _M_ht.hash_funct(); }
759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  key_equal key_eq() const { return _M_ht.key_eq(); }
769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  allocator_type get_allocator() const { return _M_ht.get_allocator(); }
779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Ht _M_ht;
809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
83e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  explicit unordered_map(size_type __n = 0, const hasher& __hf = hasher(),
849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                         const key_equal& __eql = key_equal(),
859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                         const allocator_type& __a = allocator_type())
869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a) {}
879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
88e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (_STLP_NO_MOVE_SEMANTIC)
899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_map(__move_source<_Self> src)
909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
91e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_map(_InputIterator __f, _InputIterator __l,
96e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                size_type __n = 0, const hasher& __hf = hasher(),
979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                const key_equal& __eql = key_equal(),
989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                const allocator_type& __a = allocator_type())
999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a)
1009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_unique(__f, __l); }
1019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
1029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_map(const value_type* __f, const value_type* __l,
103e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                size_type __n = 0, const hasher& __hf = hasher(),
1049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                const key_equal& __eql = key_equal(),
1059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                const allocator_type& __a = allocator_type())
1069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a)
1079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_unique(__f, __l); }
1089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_map(const_iterator __f, const_iterator __l,
110e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                size_type __n = 0, const hasher& __hf = hasher(),
1119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                const key_equal& __eql = key_equal(),
1129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                const allocator_type& __a = allocator_type())
1139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a)
1149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_unique(__f, __l); }
1159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_MEMBER_TEMPLATES */
1169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Self& operator = (const _Self& __other)
1189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht = __other._M_ht; return *this; }
1199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type size() const { return _M_ht.size(); }
1219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type max_size() const { return _M_ht.max_size(); }
1229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  bool empty() const { return _M_ht.empty(); }
1239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
124e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
125e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  void _M_swap_workaround(_Self& __x) { swap(__x); }
126e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
1279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator begin() { return _M_ht.begin(); }
1299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator end() { return _M_ht.end(); }
1309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator begin() const { return _M_ht.begin(); }
1319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator end() const { return _M_ht.end(); }
1329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<iterator,bool> insert(const value_type& __obj)
1349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.insert_unique(__obj); }
1359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert(const_iterator /*__hint*/, const value_type& __obj)
1369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.insert_unique(__obj); }
1379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
1389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
1399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(_InputIterator __f, _InputIterator __l)
1409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
1419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(const value_type* __f, const value_type* __l)
1429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_unique(__f,__l); }
1439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(const_iterator __f, const_iterator __l)
1449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_MEMBER_TEMPLATES */
1459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_unique(__f, __l); }
1469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator find(const _KT& __key) { return _M_ht.find(__key); }
1499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
1519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Tp& operator[](const _KT& __key) {
1549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    iterator __it = _M_ht.find(__key);
1559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return (__it == _M_ht.end() ?
1569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second :
1579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block      (*__it).second );
1589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
1599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type count(const _KT& __key) const { return _M_ht.count(__key); }
1629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1649720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<iterator, iterator> equal_range(const _KT& __key)
1659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.equal_range(__key); }
1669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
1689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.equal_range(__key); }
1699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
1719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(const_iterator __it) { _M_ht.erase(__it); }
1729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
1739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void clear() { _M_ht.clear(); }
1749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type bucket_count() const { return _M_ht.bucket_count(); }
1769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
1779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
1789720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
1799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
1809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
1819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  local_iterator end(size_type __n) { return _M_ht.end(__n); }
1829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
1839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
1849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
1859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  float load_factor() const { return _M_ht.load_factor(); }
1869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  float max_load_factor() const { return _M_ht.max_load_factor(); }
1879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
1889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void rehash(size_type __hint) { _M_ht.rehash(__hint); }
189e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
190e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (__DMC__) // disable operator==(pair<x,unordered_map>, pair<x,unordered_map>)
191e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  bool operator==(const _Self&) const;
192e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
1939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
1949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
195e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_END_NAMESPACE
196e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
1979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block//Specific iterator traits creation
1989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, traits)
1999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
200e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_BEGIN_TR1_NAMESPACE
201e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
2029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Tp, _STLP_DFL_TMPL_PARAM(_HashFcn,hash<_Key>),
203e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott          _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>),
204e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott          _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) >
2059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockclass unordered_multimap
2069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
2079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                    : public __stlport_class<unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> >
2089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif
2099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{
2109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
2119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self;
2129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
2139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Key key_type;
2149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Tp data_type;
2159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Tp mapped_type;
216e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  typedef pair<_STLP_CONST key_type, data_type> value_type;
2179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
2189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  //Specific iterator traits creation
2199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _STLP_PRIV _UnorderedMultimapTraitsT<value_type> _UnorderedMultimapTraits;
2209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
2229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef hashtable<value_type, key_type, _HashFcn, _UnorderedMultimapTraits,
2239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                    _STLP_SELECT1ST(value_type,  _Key), _EqualKey, _Alloc > _Ht;
2249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::hasher hasher;
2269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::key_equal key_equal;
2279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::size_type size_type;
2299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::difference_type difference_type;
2309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::pointer pointer;
2319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_pointer const_pointer;
2329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::reference reference;
2339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_reference const_reference;
2349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::iterator iterator;
2369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_iterator const_iterator;
2379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::local_iterator local_iterator;
2389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::const_local_iterator const_local_iterator;
2399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef typename _Ht::allocator_type allocator_type;
2419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  hasher hash_function() const { return _M_ht.hash_funct(); }
2439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  key_equal key_eq() const { return _M_ht.key_eq(); }
2449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  allocator_type get_allocator() const { return _M_ht.get_allocator(); }
2459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprivate:
2479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Ht _M_ht;
2489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_KEY_TYPE_FOR_CONT_EXT(key_type)
2499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
251e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  explicit unordered_multimap(size_type __n = 0, const hasher& __hf = hasher(),
2529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                              const key_equal& __eql = key_equal(),
2539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                              const allocator_type& __a = allocator_type())
2549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a) {}
2559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
256e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (_STLP_NO_MOVE_SEMANTIC)
2579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_multimap(__move_source<_Self> src)
2589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {}
259e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
2609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
2629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
2639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_multimap(_InputIterator __f, _InputIterator __l,
264e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                     size_type __n = 0, const hasher& __hf = hasher(),
2659720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     const key_equal& __eql = key_equal(),
2669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     const allocator_type& __a = allocator_type())
2679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a)
2689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_equal(__f, __l); }
2699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
2709720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_multimap(const value_type* __f, const value_type* __l,
271e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                     size_type __n = 0, const hasher& __hf = hasher(),
2729720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     const key_equal& __eql = key_equal(),
2739720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     const allocator_type& __a = allocator_type())
2749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a)
2759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_equal(__f, __l); }
2769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2779720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  unordered_multimap(const_iterator __f, const_iterator __l,
278e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott                     size_type __n = 0, const hasher& __hf = hasher(),
2799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     const key_equal& __eql = key_equal(),
2809720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block                     const allocator_type& __a = allocator_type())
2819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : _M_ht(__n, __hf, __eql, __a)
2829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_equal(__f, __l); }
2839720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_MEMBER_TEMPLATES */
2849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2859720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Self& operator = (const _Self& __other)
2869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht = __other._M_ht; return *this; }
2879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type size() const { return _M_ht.size(); }
2899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type max_size() const { return _M_ht.max_size(); }
2909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  bool empty() const { return _M_ht.empty(); }
2919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); }
292e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
293e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  void _M_swap_workaround(_Self& __x) { swap(__x); }
294e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif
2959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
2969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator begin() { return _M_ht.begin(); }
2979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator end() { return _M_ht.end(); }
2989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator begin() const { return _M_ht.begin(); }
2999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator end() const { return _M_ht.end(); }
3009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert(const value_type& __obj)
3029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.insert_equal(__obj); }
3039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator insert(const_iterator /*__hint*/, const value_type& __obj)
3049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.insert_equal(__obj); }
3059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_MEMBER_TEMPLATES)
3069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  template <class _InputIterator>
3079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(_InputIterator __f, _InputIterator __l)
3089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#else
3099720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(const value_type* __f, const value_type* __l)
3109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_equal(__f,__l); }
3119720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void insert(const_iterator __f, const_iterator __l)
3129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /*_STLP_MEMBER_TEMPLATES */
3139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { _M_ht.insert_equal(__f, __l); }
3149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
3169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  iterator find(const _KT& __key) { return _M_ht.find(__key); }
3179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
3189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_iterator find(const _KT& __key) const { return _M_ht.find(__key); }
3199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
3219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type count(const _KT& __key) const { return _M_ht.count(__key); }
3229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
3249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<iterator, iterator> equal_range(const _KT& __key)
3259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.equal_range(__key); }
3269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
3279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  pair<const_iterator, const_iterator> equal_range(const _KT& __key) const
3289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  { return _M_ht.equal_range(__key); }
3299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
3319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(const_iterator __it) { _M_ht.erase(__it); }
3329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); }
3339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void clear() { _M_ht.clear(); }
3349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type bucket_count() const { return _M_ht.bucket_count(); }
3369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
3379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); }
3389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _STLP_TEMPLATE_FOR_CONT_EXT
3399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); }
3409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  local_iterator begin(size_type __n) { return _M_ht.begin(__n); }
3419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  local_iterator end(size_type __n) { return _M_ht.end(__n); }
3429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); }
3439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  const_local_iterator end(size_type __n) const { return _M_ht.end(__n); }
3449720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3459720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  float load_factor() const { return _M_ht.load_factor(); }
3469720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  float max_load_factor() const { return _M_ht.max_load_factor(); }
3479720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void max_load_factor(float __val) { _M_ht.max_load_factor(__val); }
3489720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  void rehash(size_type __hint) { _M_ht.rehash(__hint); }
3499720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
3509720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3519720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_TEMPLATE_HEADER template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
3529720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
3539720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3549720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#include <stl/_relops_hash_cont.h>
3559720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3569720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#undef _STLP_TEMPLATE_CONTAINER
3579720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>
3589720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3599720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#include <stl/_relops_hash_cont.h>
3609720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3619720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#undef _STLP_TEMPLATE_CONTAINER
3629720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#undef _STLP_TEMPLATE_HEADER
3639720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
364e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott_STLP_END_NAMESPACE
365e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott
3669720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Specialization of insert_iterator so that it will work for unordered_map
3679720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// and unordered_multimap.
3689720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3699720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
370e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  if !defined (_STLP_NO_MOVE_SEMANTIC)
3719720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
372e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct __move_traits<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
373e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  _STLP_PRIV __move_traits_help<typename _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
3749720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{};
3759720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3769720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
377e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct __move_traits<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > :
378e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  _STLP_PRIV __move_traits_help<typename _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>::_Ht>
3799720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block{};
380e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#  endif
3819720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3829720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
383e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass insert_iterator<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
3849720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprotected:
385e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  typedef _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
3869720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Container* container;
3879720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
3889720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Container          container_type;
3899720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef output_iterator_tag iterator_category;
3909720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                value_type;
3919720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                difference_type;
3929720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                pointer;
3939720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                reference;
3949720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
3959720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator(_Container& __x) : container(&__x) {}
3969720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator(_Container& __x, typename _Container::iterator)
3979720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : container(&__x) {}
3989720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>&
3999720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  operator=(const typename _Container::value_type& __val) {
4009720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    container->insert(__val);
4019720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *this;
4029720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4039720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>& operator*() { return *this; }
4049720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>& operator++() { return *this; }
4059720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>& operator++(int) { return *this; }
4069720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
4079720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4089720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blocktemplate <class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>
409e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass insert_iterator<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > {
4109720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockprotected:
411e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott  typedef _STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container;
4129720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  _Container* container;
4139720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typename _Container::iterator iter;
4149720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Blockpublic:
4159720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef _Container          container_type;
4169720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef output_iterator_tag iterator_category;
4179720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                value_type;
4189720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                difference_type;
4199720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                pointer;
4209720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  typedef void                reference;
4219720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4229720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator(_Container& __x) : container(&__x) {}
4239720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator(_Container& __x, typename _Container::iterator)
4249720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    : container(&__x) {}
4259720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>&
4269720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  operator=(const typename _Container::value_type& __val) {
4279720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    container->insert(__val);
4289720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block    return *this;
4299720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  }
4309720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>& operator*() { return *this; }
4319720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>& operator++() { return *this; }
4329720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block  insert_iterator<_Container>& operator++(int) { return *this; }
4339720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block};
4349720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4359720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
4369720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4379720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block_STLP_END_NAMESPACE
4389720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4399720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block#endif /* _STLP_INTERNAL_UNORDERED_MAP_H */
4409720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block
4419720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// Local Variables:
4429720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// mode:C++
4439720d5f59b9c1f5d1b9ecbc9173dbcb71bd557beSteve Block// End:
444