STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
_Hash< _Traits > Class Template Reference
Inheritance diagram for _Hash< _Traits >:
stdext::hash_map< _Kty, _Ty, _Tr, _Alloc > stdext::hash_multimap< _Kty, _Ty, _Tr, _Alloc > stdext::hash_multiset< _Kty, _Tr, _Alloc > stdext::hash_set< _Kty, _Tr, _Alloc >

Public Types

enum  { _Bucket_size = key_compare::bucket_size, _Min_buckets = 8, _Multi = _Traits::_Multi }
 
typedef _Hash< _Traits > _Myt
 
typedef _Traits::key_type key_type
 
typedef _Traits::key_compare key_compare
 
typedef _Traits::value_compare value_compare
 
typedef list< typename _Traits::value_type, typename _Traits::allocator_type > _Mylist
 
typedef _Mylist::_Alty _Alty
 
typedef _Mylist::value_type value_type
 
typedef _Mylist::allocator_type allocator_type
 
typedef _Mylist::size_type size_type
 
typedef _Mylist::difference_type difference_type
 
typedef _Mylist::pointer pointer
 
typedef _Mylist::const_pointer const_pointer
 
typedef _Mylist::reference reference
 
typedef _Mylist::const_reference const_reference
 
typedef _If< is_same< key_type, value_type >::value, typename _Mylist::const_iterator, typename _Mylist::iterator >::type iterator
 
typedef _Mylist::const_iterator const_iterator
 
typedef _If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
 
typedef _Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
 
typedef _STD reverse_iterator< iteratorreverse_iterator
 
typedef _STD reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef vector< _Unchecked_iterator, typename _Alty::template rebind< _Unchecked_iterator >::other > _Myvec
 
typedef pair< iterator, bool_Pairib
 
typedef pair< iterator, iterator_Pairii
 
typedef pair< const_iterator, const_iterator_Paircc
 
typedef iterator local_iterator
 
typedef const_iterator const_local_iterator
 

Public Member Functions

 _Hash (const key_compare &_Parg, const allocator_type &_Al)
 
 _Hash (const value_type *_First, const value_type *_Last, const key_compare &_Parg, const allocator_type &_Al)
 
 _Hash (const _Myt &_Right, const allocator_type &_Al)
 
 _Hash (_Myt &&_Right, const allocator_type &_Al)
 
_Mytoperator= (_Myt &&_Right)
 
void _Assign_rv (_Myt &&_Right)
 
_Pairib insert (value_type &&_Val)
 
iterator insert (const_iterator, value_type &&_Val)
 
template<class _Valty >
enable_if< is_convertible< _Valty, value_type >::value, _Pairib >::type insert (_Valty &&_Val)
 
template<class _Valty >
enable_if< is_convertible< _Valty, value_type >::value, iterator >::type insert (const_iterator, _Valty &&_Val)
 
template<class... _Valty>
_Pairib emplace (_Valty &&..._Val)
 
template<class... _Valty>
iterator emplace_hint (const_iterator, _Valty &&..._Val)
 
 ~_Hash () _NOEXCEPT
 
_Mytoperator= (const _Myt &_Right)
 
iterator begin () _NOEXCEPT
 
const_iterator begin () const _NOEXCEPT
 
iterator end () _NOEXCEPT
 
const_iterator end () const _NOEXCEPT
 
_Unchecked_iterator _Unchecked_begin ()
 
_Unchecked_const_iterator _Unchecked_begin () const
 
_Unchecked_iterator _Unchecked_end ()
 
_Unchecked_const_iterator _Unchecked_end () const
 
iterator _Make_iter (_Unchecked_const_iterator _Where) const
 
iterator _Make_iter (const_iterator _Where) const
 
reverse_iterator rbegin () _NOEXCEPT
 
const_reverse_iterator rbegin () const _NOEXCEPT
 
reverse_iterator rend () _NOEXCEPT
 
const_reverse_iterator rend () const _NOEXCEPT
 
const_iterator cbegin () const _NOEXCEPT
 
const_iterator cend () const _NOEXCEPT
 
const_reverse_iterator crbegin () const _NOEXCEPT
 
const_reverse_iterator crend () const _NOEXCEPT
 
size_type size () const _NOEXCEPT
 
size_type max_size () const _NOEXCEPT
 
bool empty () const _NOEXCEPT
 
allocator_type get_allocator () const _NOEXCEPT
 
key_compare key_comp () const
 
value_compare value_comp () const
 
size_type bucket_count () const _NOEXCEPT
 
size_type max_bucket_count () const _NOEXCEPT
 
size_type bucket (const key_type &_Keyval) const
 
size_type bucket_size (size_type _Bucket) const
 
local_iterator begin (size_type _Bucket)
 
const_local_iterator begin (size_type _Bucket) const
 
local_iterator end (size_type _Bucket)
 
const_local_iterator end (size_type _Bucket) const
 
const_local_iterator cbegin (size_type _Bucket) const _NOEXCEPT
 
const_local_iterator cend (size_type _Bucket) const _NOEXCEPT
 
float load_factor () const _NOEXCEPT
 
float max_load_factor () const _NOEXCEPT
 
void max_load_factor (float _Newmax)
 
void rehash (size_type _Buckets)
 
void reserve (size_type _Maxcount)
 
_Pairib insert (const value_type &_Val)
 
iterator insert (const_iterator, const value_type &_Val)
 
template<class _Iter >
void insert (_Iter _First, _Iter _Last)
 
void insert (_XSTD initializer_list< value_type > _Ilist)
 
iterator erase (const_iterator _Plist)
 
iterator erase (const_iterator _First, const_iterator _Last)
 
size_type erase (const key_type &_Keyval)
 
void clear () _NOEXCEPT
 
iterator find (const key_type &_Keyval)
 
const_iterator find (const key_type &_Keyval) const
 
size_type count (const key_type &_Keyval) const
 
iterator lower_bound (const key_type &_Keyval)
 
const_iterator lower_bound (const key_type &_Keyval) const
 
iterator upper_bound (const key_type &_Keyval)
 
const_iterator upper_bound (const key_type &_Keyval) const
 
_Pairii equal_range (const key_type &_Keyval)
 
_Paircc equal_range (const key_type &_Keyval) const
 
void swap (_Myt &_Right)
 

Protected Member Functions

template<class _Valty >
_Unchecked_iterator _Buynode_if_nil (_Valty &&, _Unchecked_iterator _Plist)
 
template<class _Valty >
_Unchecked_iterator _Buynode_if_nil (_Valty &&_Val, _Nil)
 
void _Destroy_if_not_nil (_Unchecked_iterator _Plist)
 
void _Destroy_if_not_nil (_Nil)
 
template<class _Valty , class _Nodety >
_Pairib _Insert (_Valty &&_Val, _Nodety _Pnode)
 
_Unchecked_iterator_Vec_lo (size_type _Bucket)
 
_Unchecked_const_iterator_Vec_lo (size_type _Bucket) const
 
_Unchecked_iterator_Vec_hi (size_type _Bucket)
 
_Unchecked_const_iterator_Vec_hi (size_type _Bucket) const
 
_Unchecked_iterator _Begin (size_type _Bucket)
 
_Unchecked_const_iterator _Begin (size_type _Bucket) const
 
_Unchecked_iterator _End (size_type _Bucket)
 
_Unchecked_const_iterator _End (size_type _Bucket) const
 
void _Erase_bucket (iterator _Plist_arg, size_type _Bucket)
 
void _Insert_bucket (_Unchecked_iterator _Plist, _Unchecked_iterator _Where, size_type _Bucket)
 
void _Copy (const _Myt &_Right)
 
size_type _Hashval (const key_type &_Keyval) const
 
void _Init (size_type _Buckets=_Min_buckets)
 
void _Check_size ()
 
void _Reinsert ()
 

Protected Attributes

_Mylist _List
 
_Myvec _Vec
 
size_type _Mask
 
size_type _Maxidx
 
float _Max_bucket_size
 

Member Typedef Documentation

template<class _Traits>
typedef _Mylist::_Alty _Hash< _Traits >::_Alty
template<class _Traits>
typedef list<typename _Traits::value_type, typename _Traits::allocator_type> _Hash< _Traits >::_Mylist
template<class _Traits>
typedef _Hash<_Traits> _Hash< _Traits >::_Myt
template<class _Traits>
typedef vector<_Unchecked_iterator, typename _Alty::template rebind<_Unchecked_iterator>::other> _Hash< _Traits >::_Myvec
template<class _Traits>
typedef pair<const_iterator, const_iterator> _Hash< _Traits >::_Paircc
template<class _Traits>
typedef pair<iterator, bool> _Hash< _Traits >::_Pairib
template<class _Traits>
typedef pair<iterator, iterator> _Hash< _Traits >::_Pairii
template<class _Traits>
typedef _Mylist::_Unchecked_const_iterator _Hash< _Traits >::_Unchecked_const_iterator
template<class _Traits>
typedef _If<is_same<key_type, value_type>::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator>::type _Hash< _Traits >::_Unchecked_iterator
template<class _Traits>
typedef _Mylist::allocator_type _Hash< _Traits >::allocator_type
template<class _Traits>
typedef _Mylist::const_iterator _Hash< _Traits >::const_iterator
template<class _Traits>
typedef const_iterator _Hash< _Traits >::const_local_iterator
template<class _Traits>
typedef _Mylist::const_pointer _Hash< _Traits >::const_pointer
template<class _Traits>
typedef _Mylist::const_reference _Hash< _Traits >::const_reference
template<class _Traits>
typedef _STD reverse_iterator<const_iterator> _Hash< _Traits >::const_reverse_iterator
template<class _Traits>
typedef _Mylist::difference_type _Hash< _Traits >::difference_type
template<class _Traits>
typedef _If<is_same<key_type, value_type>::value, typename _Mylist::const_iterator, typename _Mylist::iterator>::type _Hash< _Traits >::iterator
template<class _Traits>
typedef _Traits::key_compare _Hash< _Traits >::key_compare
template<class _Traits>
typedef _Traits::key_type _Hash< _Traits >::key_type
template<class _Traits>
typedef iterator _Hash< _Traits >::local_iterator
template<class _Traits>
typedef _Mylist::pointer _Hash< _Traits >::pointer
template<class _Traits>
typedef _Mylist::reference _Hash< _Traits >::reference
template<class _Traits>
typedef _STD reverse_iterator<iterator> _Hash< _Traits >::reverse_iterator
template<class _Traits>
typedef _Mylist::size_type _Hash< _Traits >::size_type
template<class _Traits>
typedef _Traits::value_compare _Hash< _Traits >::value_compare
template<class _Traits>
typedef _Mylist::value_type _Hash< _Traits >::value_type

Member Enumeration Documentation

template<class _Traits>
anonymous enum
Enumerator
_Bucket_size 
_Min_buckets 
_Multi 
263  { // various constants
264  _Bucket_size = key_compare::bucket_size,
265  _Min_buckets = 8, // min_buckets = 2 ^^ N, 0 < N
266  _Multi = _Traits::_Multi};
Definition: xhash:265
Definition: xhash:266
Definition: xhash:264

Constructor & Destructor Documentation

template<class _Traits>
_Hash< _Traits >::_Hash ( const key_compare _Parg,
const allocator_type _Al 
)
inline
305  : _Traits(_Parg),
306 
307  _List(_Al),
308  _Vec(_Al),
309 
311  { // construct empty hash table
312  _Init();
313  }
float _Max_bucket_size
Definition: xhash:1045
Definition: xhash:264
_Mylist _List
Definition: xhash:1041
void _Init(size_type _Buckets=_Min_buckets)
Definition: xhash:1004
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Hash< _Traits >::_Hash ( const value_type _First,
const value_type _Last,
const key_compare _Parg,
const allocator_type _Al 
)
inline
317  : _Traits(_Parg),
318 
319  _List(_Al),
320  _Vec(_Al),
321 
323  { // construct hash table from [_First, _Last) array
324  _Init();
325  insert(_First, _Last);
326  }
float _Max_bucket_size
Definition: xhash:1045
Definition: xhash:264
_Mylist _List
Definition: xhash:1041
_Pairib insert(value_type &&_Val)
Definition: xhash:363
_FwdIt _Last
Definition: algorithm:1936
void _Init(size_type _Buckets=_Min_buckets)
Definition: xhash:1004
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Hash< _Traits >::_Hash ( const _Myt _Right,
const allocator_type _Al 
)
inline
329  : _Traits(),
330 
331  _List(_Al),
332  _Vec(_Al),
333 
335  { // construct hash table by copying right
336  _Copy(_Right);
337  }
void _Copy(const _Myt &_Right)
Definition: xhash:979
float _Max_bucket_size
Definition: xhash:1045
Definition: xhash:264
_Mylist _List
Definition: xhash:1041
const _Ty & _Right
Definition: algorithm:4087
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Hash< _Traits >::_Hash ( _Myt &&  _Right,
const allocator_type _Al 
)
inline
340  : _Traits(),
341 
342  _List(_Al),
343  _Vec(_Al),
344 
346  { // construct hash table by moving _Right, allocator
347  _Assign_rv(_STD forward<_Myt>(_Right));
348  }
void _Assign_rv(_Myt &&_Right)
Definition: xhash:357
float _Max_bucket_size
Definition: xhash:1045
Definition: xhash:264
_Mylist _List
Definition: xhash:1041
const _Ty & _Right
Definition: algorithm:4087
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Hash< _Traits >::~_Hash ( )
inline
407  { // destroy hash table
408 // _List.clear(); // speed orphaning of checked iterators
409  }

Member Function Documentation

template<class _Traits>
void _Hash< _Traits >::_Assign_rv ( _Myt &&  _Right)
inline
358  { // assign by moving _Right
359  _Right.swap(*this);
360  _Right.clear();
361  }
const _Ty & _Right
Definition: algorithm:4087
template<class _Traits>
_Unchecked_iterator _Hash< _Traits >::_Begin ( size_type  _Bucket)
inlineprotected
920  { // return begin iterator for bucket _Bucket
921  return (_Vec_lo(_Bucket));
922  }
_Unchecked_iterator & _Vec_lo(size_type _Bucket)
Definition: xhash:899
template<class _Traits>
_Unchecked_const_iterator _Hash< _Traits >::_Begin ( size_type  _Bucket) const
inlineprotected
925  { // return begin iterator for bucket _Bucket
926  return (_Vec_lo(_Bucket));
927  }
_Unchecked_iterator & _Vec_lo(size_type _Bucket)
Definition: xhash:899
template<class _Traits>
template<class _Valty >
_Unchecked_iterator _Hash< _Traits >::_Buynode_if_nil ( _Valty &&  ,
_Unchecked_iterator  _Plist 
)
inlineprotected
838  { // node exists, just return it
839  return (_Plist);
840  }
template<class _Traits>
template<class _Valty >
_Unchecked_iterator _Hash< _Traits >::_Buynode_if_nil ( _Valty &&  _Val,
_Nil   
)
inlineprotected
844  { // node doesn't exist, make it
845  _List.push_front(_STD forward<_Valty>(_Val));
846  return (_Unchecked_begin());
847  }
void push_front(_Ty &&_Val)
Definition: list:1016
_Mylist _List
Definition: xhash:1041
_Unchecked_iterator _Unchecked_begin()
Definition: xhash:438
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
void _Hash< _Traits >::_Check_size ( )
inlineprotected
1012  { // grow table as needed
1013  if (max_load_factor() < load_factor())
1014 
1015  { // rehash to bigger table
1016  size_type _Newsize = bucket_count();
1017 
1018  if (_Newsize < 512)
1019  _Newsize *= 8; // multiply by 8
1020  else if (_Newsize < _Vec.max_size() / 2)
1021  _Newsize *= 2; // multiply safely by 2
1022  _Init(_Newsize);
1023  _Reinsert();
1024  }
1025  }
size_type max_size() const _NOEXCEPT
Definition: vector:1151
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
void _Reinsert()
Definition: xhash:1027
_Mylist::size_type size_type
Definition: xhash:273
float max_load_factor() const _NOEXCEPT
Definition: xhash:620
float load_factor() const _NOEXCEPT
Definition: xhash:615
void _Init(size_type _Buckets=_Min_buckets)
Definition: xhash:1004
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
void _Hash< _Traits >::_Copy ( const _Myt _Right)
inlineprotected
980  { // copy entire hash table
981  _Mask = _Right._Mask;
982  _Maxidx = _Right._Maxidx;
983  _Max_bucket_size = _Right._Max_bucket_size;
984  _List.clear();
985 
986  _TRY_BEGIN
987  (_Traits&)*this = (_Traits&)_Right;
988  _Vec.assign(_Right._Vec.size(), _Unchecked_end());
989  insert(_Right.begin(), _Right.end());
990  _CATCH_ALL
991  clear(); // list or compare copy failed, bail out
992  _RERAISE;
993  _CATCH_END
994  }
void clear() _NOEXCEPT
Definition: list:1490
size_type _Mask
Definition: xhash:1043
float _Max_bucket_size
Definition: xhash:1045
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
void clear() _NOEXCEPT
Definition: xhash:715
_Mylist _List
Definition: xhash:1041
size_type _Maxidx
Definition: xhash:1044
#define _CATCH_ALL
Definition: xstddef:62
_Pairib insert(value_type &&_Val)
Definition: xhash:363
void assign(_XSTD initializer_list< value_type > _Ilist)
Definition: vector:932
#define _RERAISE
Definition: xstddef:74
const _Ty & _Right
Definition: algorithm:4087
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
void _Hash< _Traits >::_Destroy_if_not_nil ( _Unchecked_iterator  _Plist)
inlineprotected
850  { // node exists, destroy it
851  _List.erase(_Make_iter(_Plist));
852  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Mylist _List
Definition: xhash:1041
iterator erase(const_iterator _Where)
Definition: list:1456
template<class _Traits>
void _Hash< _Traits >::_Destroy_if_not_nil ( _Nil  )
inlineprotected
855  { // node doesn't exist, do nothing
856  }
template<class _Traits>
_Unchecked_iterator _Hash< _Traits >::_End ( size_type  _Bucket)
inlineprotected
930  { // return end iterator for bucket _Bucket
931  if (_Vec_lo(_Bucket) == _Unchecked_end())
932  return (_Unchecked_end());
933  else
934  { // point past last element
935  _Unchecked_iterator _Ans = _Vec_hi(_Bucket);
936  return (++_Ans);
937  }
938  }
_Unchecked_iterator & _Vec_hi(size_type _Bucket)
Definition: xhash:909
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
_Unchecked_iterator & _Vec_lo(size_type _Bucket)
Definition: xhash:899
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
_Unchecked_const_iterator _Hash< _Traits >::_End ( size_type  _Bucket) const
inlineprotected
940  { // return end iterator for bucket _Bucket
941  if (_Vec_lo(_Bucket) == _Unchecked_end())
942  return (_Unchecked_end());
943  else
944  { // point past last element
945  _Unchecked_const_iterator _Ans = _Vec_hi(_Bucket);
946  return (++_Ans);
947  }
948  }
_Unchecked_iterator & _Vec_hi(size_type _Bucket)
Definition: xhash:909
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
_Unchecked_iterator & _Vec_lo(size_type _Bucket)
Definition: xhash:899
template<class _Traits>
void _Hash< _Traits >::_Erase_bucket ( iterator  _Plist_arg,
size_type  _Bucket 
)
inlineprotected
951  { // fix iterators before erasing _Plist before _Where
952  _Unchecked_iterator _Plist = _Plist_arg._Unchecked();
953  if (_Vec_hi(_Bucket) == _Plist)
954  if (_Vec_lo(_Bucket) == _Plist)
955  { // make bucket empty
956  _Vec_lo(_Bucket) = _Unchecked_end();
957  _Vec_hi(_Bucket) = _Unchecked_end();
958  }
959  else
960  _Vec_hi(_Bucket) = --_Plist; // move end back one element
961  else if (_Vec_lo(_Bucket) == _Plist)
962  _Vec_lo(_Bucket) = ++_Plist; // move beginning up one element
963  }
_Unchecked_iterator & _Vec_hi(size_type _Bucket)
Definition: xhash:909
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
_Unchecked_iterator & _Vec_lo(size_type _Bucket)
Definition: xhash:899
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
size_type _Hash< _Traits >::_Hashval ( const key_type _Keyval) const
inlineprotected
997  { // return hash value, masked and wrapped to current table size
998  size_type _Num = ((_Traits&)*this)(_Keyval) & _Mask;
999  if (_Maxidx <= _Num)
1000  _Num -= (_Mask >> 1) + 1;
1001  return (_Num);
1002  }
size_type _Mask
Definition: xhash:1043
size_type _Maxidx
Definition: xhash:1044
_Mylist::size_type size_type
Definition: xhash:273
template<class _Traits>
void _Hash< _Traits >::_Init ( size_type  _Buckets = _Min_buckets)
inlineprotected
1005  { // initialize hash table with _Buckets buckets, leave list alone
1006  _Vec.assign(2 * _Buckets, _Unchecked_end());
1007  _Mask = _Buckets - 1;
1008  _Maxidx = _Buckets;
1009  }
size_type _Mask
Definition: xhash:1043
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
size_type _Maxidx
Definition: xhash:1044
void assign(_XSTD initializer_list< value_type > _Ilist)
Definition: vector:932
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
template<class _Valty , class _Nodety >
_Pairib _Hash< _Traits >::_Insert ( _Valty &&  _Val,
_Nodety  _Pnode 
)
inlineprotected
861  { // try to insert existing node with value _Val
862  size_type _Bucket;
863  _Unchecked_iterator _Where;
864 
865  _TRY_BEGIN
866  _Bucket = _Hashval(this->_Kfn(_Val));
867  _Where = _End(_Bucket);
868  for (; _Where != _Begin(_Bucket); )
869  if (((_Traits&)*this)(this->_Kfn(_Val), this->_Kfn(*--_Where)))
870  ; // still too high in bucket list
871  else if (_Multi
872  || ((_Traits&)*this)(this->_Kfn(*_Where), this->_Kfn(_Val)))
873  { // found insertion point, back up to it
874  ++_Where;
875  break;
876  }
877  else
878  { // discard new list element and return existing
879  _Destroy_if_not_nil(_Pnode);
880  return (_Pairib(_Make_iter(_Where), false));
881  }
882  _CATCH_ALL
883  _Destroy_if_not_nil(_Pnode);
884  _RERAISE;
885  _CATCH_END
886 
887  _Unchecked_iterator _Plist =
888  _Buynode_if_nil(_STD forward<_Valty>(_Val), _Pnode);
889  _Unchecked_iterator _Next = _Plist;
890 
891  if (_Where != ++_Next) // move element into place
892  _List._Unchecked_splice(_Where, _Plist, _Next);
893 
894  _Insert_bucket(_Plist, _Where, _Bucket);
895  _Check_size();
896  return (_Pairib(_Make_iter(_Plist), true));
897  }
_Unchecked_iterator _Buynode_if_nil(_Valty &&, _Unchecked_iterator _Plist)
Definition: xhash:836
Definition: xhash:266
#define _TRY_BEGIN
Definition: xstddef:60
void _Check_size()
Definition: xhash:1011
#define _CATCH_END
Definition: xstddef:63
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
void _Insert_bucket(_Unchecked_iterator _Plist, _Unchecked_iterator _Where, size_type _Bucket)
Definition: xhash:965
void _Destroy_if_not_nil(_Unchecked_iterator _Plist)
Definition: xhash:849
pair< iterator, bool > _Pairib
Definition: xhash:299
_Mylist _List
Definition: xhash:1041
#define _CATCH_ALL
Definition: xstddef:62
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
void _Unchecked_splice(_Unchecked_const_iterator _Where, _Unchecked_const_iterator _First, _Unchecked_const_iterator _Last)
Definition: list:1862
#define _RERAISE
Definition: xstddef:74
_FwdIt const _Ty _Val
Definition: algorithm:1938
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
void _Hash< _Traits >::_Insert_bucket ( _Unchecked_iterator  _Plist,
_Unchecked_iterator  _Where,
size_type  _Bucket 
)
inlineprotected
967  { // fix iterators after inserting _Plist before _Where
968  if (_Vec_lo(_Bucket) == _Unchecked_end())
969  { // make bucket non-empty
970  _Vec_lo(_Bucket) = _Plist;
971  _Vec_hi(_Bucket) = _Plist;
972  }
973  else if (_Vec_lo(_Bucket) == _Where)
974  _Vec_lo(_Bucket) = _Plist; // move beginning back one element
975  else if (++_Vec_hi(_Bucket) != _Plist) // move end up one element
976  --_Vec_hi(_Bucket); // or not
977  }
_Unchecked_iterator & _Vec_hi(size_type _Bucket)
Definition: xhash:909
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
_Unchecked_iterator & _Vec_lo(size_type _Bucket)
Definition: xhash:899
template<class _Traits>
iterator _Hash< _Traits >::_Make_iter ( _Unchecked_const_iterator  _Where) const
inline
459  { // make iterator from _Unchecked_const_iterator
460  return (_List._Make_iter(_Where));
461  }
_Mylist _List
Definition: xhash:1041
iterator _Make_iter(const_iterator _Where) const _NOEXCEPT
Definition: list:1156
template<class _Traits>
iterator _Hash< _Traits >::_Make_iter ( const_iterator  _Where) const
inline
464  { // make iterator from const_iterator
465  return (_List._Make_iter(_Where));
466  }
_Mylist _List
Definition: xhash:1041
iterator _Make_iter(const_iterator _Where) const _NOEXCEPT
Definition: list:1156
template<class _Traits>
void _Hash< _Traits >::_Reinsert ( )
inlineprotected
1028  { // insert elements in [begin(), end())
1030  if (_Unchecked_begin() != _Last)
1031  for (--_Last; ; )
1032  { // reinsert elements in [begin(), _Last]
1034  bool _Done = _First == _Last;
1035  _Insert(*_First, _First);
1036  if (_Done)
1037  break;
1038  }
1039  }
_Unchecked_iterator _Unchecked_end()
Definition: xhash:448
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
_Unchecked_iterator _Unchecked_begin()
Definition: xhash:438
_FwdIt _Last
Definition: algorithm:1936
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
_Unchecked_iterator _Hash< _Traits >::_Unchecked_begin ( )
inline
439  { // return iterator for beginning of mutable sequence
440  return (_List._Unchecked_begin());
441  }
_Unchecked_iterator _Unchecked_begin()
Definition: list:1134
_Mylist _List
Definition: xhash:1041
template<class _Traits>
_Unchecked_const_iterator _Hash< _Traits >::_Unchecked_begin ( ) const
inline
444  { // return iterator for beginning of nonmutable sequence
445  return (_List._Unchecked_begin());
446  }
_Unchecked_iterator _Unchecked_begin()
Definition: list:1134
_Mylist _List
Definition: xhash:1041
template<class _Traits>
_Unchecked_iterator _Hash< _Traits >::_Unchecked_end ( )
inline
449  { // return iterator for end of mutable sequence
450  return (_List._Unchecked_end());
451  }
_Unchecked_iterator _Unchecked_end()
Definition: list:1146
_Mylist _List
Definition: xhash:1041
template<class _Traits>
_Unchecked_const_iterator _Hash< _Traits >::_Unchecked_end ( ) const
inline
454  { // return iterator for end of nonmutable sequence
455  return (_List._Unchecked_end());
456  }
_Unchecked_iterator _Unchecked_end()
Definition: list:1146
_Mylist _List
Definition: xhash:1041
template<class _Traits>
_Unchecked_iterator& _Hash< _Traits >::_Vec_hi ( size_type  _Bucket)
inlineprotected
910  { // return reference to end()-1 for _Bucket
911  return (_Vec[2 * _Bucket + 1]);
912  }
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Unchecked_const_iterator& _Hash< _Traits >::_Vec_hi ( size_type  _Bucket) const
inlineprotected
915  { // return reference to end()-1 for _Bucket
916  return ((_Unchecked_const_iterator&)_Vec[2 * _Bucket + 1]);
917  }
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Unchecked_iterator& _Hash< _Traits >::_Vec_lo ( size_type  _Bucket)
inlineprotected
900  { // return reference to begin() for _Bucket
901  return (_Vec[2 * _Bucket]);
902  }
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
_Unchecked_const_iterator& _Hash< _Traits >::_Vec_lo ( size_type  _Bucket) const
inlineprotected
905  { // return reference to begin() for _Bucket
906  return ((_Unchecked_const_iterator&)_Vec[2 * _Bucket]);
907  }
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
iterator _Hash< _Traits >::begin ( )
inline
419  { // return iterator for beginning of mutable sequence
420  return (_List.begin());
421  }
iterator begin() _NOEXCEPT
Definition: list:1114
_Mylist _List
Definition: xhash:1041
template<class _Traits>
const_iterator _Hash< _Traits >::begin ( ) const
inline
424  { // return iterator for beginning of nonmutable sequence
425  return (_List.begin());
426  }
iterator begin() _NOEXCEPT
Definition: list:1114
_Mylist _List
Definition: xhash:1041
template<class _Traits>
local_iterator _Hash< _Traits >::begin ( size_type  _Bucket)
inline
568  { // return iterator for bucket _Bucket
569  if (_Bucket < bucket_count())
570  return (_Make_iter(_Begin(_Bucket)));
571  else
572  return (end());
573  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
iterator end() _NOEXCEPT
Definition: xhash:428
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
template<class _Traits>
const_local_iterator _Hash< _Traits >::begin ( size_type  _Bucket) const
inline
576  { // return iterator for bucket _Bucket
577  if (_Bucket < bucket_count())
578  return (_Make_iter(_Begin(_Bucket)));
579  else
580  return (end());
581  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
iterator end() _NOEXCEPT
Definition: xhash:428
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
template<class _Traits>
size_type _Hash< _Traits >::bucket ( const key_type _Keyval) const
inline
553  { // return bucket corresponding to _Key
554  return (_Hashval(_Keyval));
555  }
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
template<class _Traits>
size_type _Hash< _Traits >::bucket_count ( ) const
inline
543  { // return number of buckets
544  return (_Maxidx);
545  }
size_type _Maxidx
Definition: xhash:1044
template<class _Traits>
size_type _Hash< _Traits >::bucket_size ( size_type  _Bucket) const
inline
558  { // return size of bucket _Bucket
559  size_type _Ans = 0;
560  if (_Bucket < _Maxidx)
561  for (_Unchecked_const_iterator _Plist = _Begin(_Bucket);
562  _Plist != _End(_Bucket); ++_Plist)
563  ++_Ans;
564  return (_Ans);
565  }
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
size_type _Maxidx
Definition: xhash:1044
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
template<class _Traits>
const_iterator _Hash< _Traits >::cbegin ( ) const
inline
489  { // return iterator for beginning of nonmutable sequence
490  return (((const _Myt *)this)->begin());
491  }
_Hash< _Traits > _Myt
Definition: xhash:257
iterator begin() _NOEXCEPT
Definition: xhash:418
template<class _Traits>
const_local_iterator _Hash< _Traits >::cbegin ( size_type  _Bucket) const
inline
600  { // return iterator for bucket _Bucket
601  if (_Bucket < bucket_count())
602  return (_Make_iter(_Begin(_Bucket)));
603  else
604  return (end());
605  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
iterator end() _NOEXCEPT
Definition: xhash:428
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
template<class _Traits>
const_iterator _Hash< _Traits >::cend ( ) const
inline
494  { // return iterator for end of nonmutable sequence
495  return (((const _Myt *)this)->end());
496  }
_Hash< _Traits > _Myt
Definition: xhash:257
iterator end() _NOEXCEPT
Definition: xhash:428
template<class _Traits>
const_local_iterator _Hash< _Traits >::cend ( size_type  _Bucket) const
inline
608  { // return iterator for bucket following _Bucket
609  if (_Bucket < bucket_count())
610  return (_Make_iter(_End(_Bucket)));
611  else
612  return (end());
613  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
template<class _Traits>
void _Hash< _Traits >::clear ( )
inline
716  { // erase all
717  _List.clear();
718  _Init();
719  }
void clear() _NOEXCEPT
Definition: list:1490
_Mylist _List
Definition: xhash:1041
void _Init(size_type _Buckets=_Min_buckets)
Definition: xhash:1004
template<class _Traits>
size_type _Hash< _Traits >::count ( const key_type _Keyval) const
inline
732  { // count all elements that match _Keyval
733  _Paircc _Ans = equal_range(_Keyval);
734  size_type _Num = 0;
735  _Distance(_Ans.first, _Ans.second, _Num);
736  return (_Num);
737  }
void _Distance(_InIt _First, _InIt _Last, _Diff &_Off)
Definition: xutility:764
pair< const_iterator, const_iterator > _Paircc
Definition: xhash:301
_Pairii equal_range(const key_type &_Keyval)
Definition: xhash:783
_Mylist::size_type size_type
Definition: xhash:273
template<class _Traits>
const_reverse_iterator _Hash< _Traits >::crbegin ( ) const
inline
499  { // return iterator for beginning of reversed nonmutable sequence
500  return (((const _Myt *)this)->rbegin());
501  }
_Hash< _Traits > _Myt
Definition: xhash:257
reverse_iterator rbegin() _NOEXCEPT
Definition: xhash:468
template<class _Traits>
const_reverse_iterator _Hash< _Traits >::crend ( ) const
inline
504  { // return iterator for end of reversed nonmutable sequence
505  return (((const _Myt *)this)->rend());
506  }
_Hash< _Traits > _Myt
Definition: xhash:257
reverse_iterator rend() _NOEXCEPT
Definition: xhash:478
template<class _Traits>
template<class... _Valty>
_Pairib _Hash< _Traits >::emplace ( _Valty &&...  _Val)
inline
393  { // try to insert value_type(_Val...)
394  _List.emplace_front(_STD forward<_Valty>(_Val)...);
395  return (_Insert(_List.front(), _Unchecked_begin()));
396  }
void emplace_front(_Valty &&..._Val)
Definition: list:1032
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
_Mylist _List
Definition: xhash:1041
reference front()
Definition: list:1254
_Unchecked_iterator _Unchecked_begin()
Definition: xhash:438
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class... _Valty>
iterator _Hash< _Traits >::emplace_hint ( const_iterator  ,
_Valty &&...  _Val 
)
inline
400  { // try to insert value_type(_Val...), ignore hint
401  _List.emplace_front(_STD forward<_Valty>(_Val)...);
402  return (_Insert(_List.front(), _Unchecked_begin()).first);
403  }
void emplace_front(_Valty &&..._Val)
Definition: list:1032
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
_Mylist _List
Definition: xhash:1041
reference front()
Definition: list:1254
_Unchecked_iterator _Unchecked_begin()
Definition: xhash:438
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
bool _Hash< _Traits >::empty ( ) const
inline
519  { // return true only if sequence is empty
520  return (_List.empty());
521  }
bool empty() const _NOEXCEPT
Definition: list:1244
_Mylist _List
Definition: xhash:1041
template<class _Traits>
iterator _Hash< _Traits >::end ( )
inline
429  { // return iterator for end of mutable sequence
430  return (_List.end());
431  }
iterator end() _NOEXCEPT
Definition: list:1124
_Mylist _List
Definition: xhash:1041
template<class _Traits>
const_iterator _Hash< _Traits >::end ( ) const
inline
434  { // return iterator for end of nonmutable sequence
435  return (_List.end());
436  }
iterator end() _NOEXCEPT
Definition: list:1124
_Mylist _List
Definition: xhash:1041
template<class _Traits>
local_iterator _Hash< _Traits >::end ( size_type  _Bucket)
inline
584  { // return iterator for bucket following _Bucket
585  if (_Bucket < bucket_count())
586  return (_Make_iter(_End(_Bucket)));
587  else
588  return (end());
589  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
template<class _Traits>
const_local_iterator _Hash< _Traits >::end ( size_type  _Bucket) const
inline
592  { // return iterator for bucket following _Bucket
593  if (_Bucket < bucket_count())
594  return (_Make_iter(_End(_Bucket)));
595  else
596  return (end());
597  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
template<class _Traits>
_Pairii _Hash< _Traits >::equal_range ( const key_type _Keyval)
inline
784  { // find range equivalent to _Keyval in mutable hash table
785  size_type _Bucket = _Hashval(_Keyval);
786  for (_Unchecked_iterator _Where = _Begin(_Bucket);
787  _Where != _End(_Bucket); ++_Where)
788  if (!((_Traits&)*this)(this->_Kfn(*_Where), _Keyval))
789  { // found _First, look for end of range
790  _Unchecked_iterator _First = _Where;
791  for (; _Where != _End(_Bucket); ++_Where)
792  if (((_Traits&)*this)(_Keyval, this->_Kfn(*_Where)))
793  break;
794  if (_First == _Where)
795  break;
796  return (_Pairii(_Make_iter(_First),
797  _Make_iter(_Where)));
798  }
799  return (_Pairii(end(), end()));
800  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
pair< iterator, iterator > _Pairii
Definition: xhash:300
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
_Paircc _Hash< _Traits >::equal_range ( const key_type _Keyval) const
inline
803  { // find range equivalent to _Keyval in nonmutable hash table
804  size_type _Bucket = _Hashval(_Keyval);
805  for (_Unchecked_const_iterator _Where = _Begin(_Bucket);
806  _Where != _End(_Bucket); ++_Where)
807  if (!((_Traits&)*this)(this->_Kfn(*_Where), _Keyval))
808  { // found _First, look for end of range
809  _Unchecked_const_iterator _First = _Where;
810  for (; _Where != _End(_Bucket); ++_Where)
811  if (((_Traits&)*this)(_Keyval, this->_Kfn(*_Where)))
812  break;
813  if (_First == _Where)
814  break;
815  return (_Paircc(_Make_iter(_First),
816  _Make_iter(_Where)));
817  }
818  return (_Paircc(end(), end()));
819  }
pair< const_iterator, const_iterator > _Paircc
Definition: xhash:301
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
template<class _Traits>
iterator _Hash< _Traits >::erase ( const_iterator  _Plist)
inline
683  { // erase element at _Plist
684  size_type _Bucket = _Hashval(this->_Kfn(*_Plist));
685 
686  _Erase_bucket(_Make_iter(_Plist), _Bucket);
687  return (_List.erase(_Plist));
688  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
void _Erase_bucket(iterator _Plist_arg, size_type _Bucket)
Definition: xhash:950
_Mylist _List
Definition: xhash:1041
iterator erase(const_iterator _Where)
Definition: list:1456
_Mylist::size_type size_type
Definition: xhash:273
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
template<class _Traits>
iterator _Hash< _Traits >::erase ( const_iterator  _First,
const_iterator  _Last 
)
inline
691  { // erase [_First, _Last)
692  _DEBUG_RANGE(_First, _Last);
693  if (_First == begin() && _Last == end())
694  { // erase all
695  clear();
696  return (begin());
697  }
698  else
699  { // partial erase, one at a time
700  while (_First != _Last)
701  erase(_First++);
702  return (_Make_iter(_First));
703  }
704  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
void clear() _NOEXCEPT
Definition: xhash:715
iterator begin() _NOEXCEPT
Definition: xhash:418
iterator end() _NOEXCEPT
Definition: xhash:428
iterator erase(const_iterator _Plist)
Definition: xhash:682
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
size_type _Hash< _Traits >::erase ( const key_type _Keyval)
inline
707  { // erase and count all that match _Keyval
708  _Pairii _Where = equal_range(_Keyval);
709  size_type _Num = 0;
710  _Distance(_Where.first, _Where.second, _Num);
711  erase(_Where.first, _Where.second);
712  return (_Num);
713  }
void _Distance(_InIt _First, _InIt _Last, _Diff &_Off)
Definition: xutility:764
_Pairii equal_range(const key_type &_Keyval)
Definition: xhash:783
pair< iterator, iterator > _Pairii
Definition: xhash:300
_Mylist::size_type size_type
Definition: xhash:273
iterator erase(const_iterator _Plist)
Definition: xhash:682
template<class _Traits>
iterator _Hash< _Traits >::find ( const key_type _Keyval)
inline
722  { // find an element in mutable hash table that matches _Keyval
723  return (lower_bound(_Keyval));
724  }
iterator lower_bound(const key_type &_Keyval)
Definition: xhash:739
template<class _Traits>
const_iterator _Hash< _Traits >::find ( const key_type _Keyval) const
inline
727  { // find an element in nonmutable hash table that matches _Keyval
728  return (lower_bound(_Keyval));
729  }
iterator lower_bound(const key_type &_Keyval)
Definition: xhash:739
template<class _Traits>
allocator_type _Hash< _Traits >::get_allocator ( ) const
inline
524  { // return allocator object for values
525  return (_List.get_allocator());
526  }
_Mylist _List
Definition: xhash:1041
allocator_type get_allocator() const _NOEXCEPT
Definition: list:1249
template<class _Traits>
_Pairib _Hash< _Traits >::insert ( value_type &&  _Val)
inline
364  { // try to insert node with value _Val, favoring right side
365  return (_Insert(_STD forward<value_type>(_Val), _Nil_obj));
366  }
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
static _Nil _Nil_obj
Definition: xtr1common:29
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
iterator _Hash< _Traits >::insert ( const_iterator  ,
value_type &&  _Val 
)
inline
369  { // try to insert node with value _Val ignoring hint
370  return (_Insert(_STD forward<value_type>(_Val), _Nil_obj).first);
371  }
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
static _Nil _Nil_obj
Definition: xtr1common:29
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Valty >
enable_if<is_convertible<_Valty, value_type>::value, _Pairib>::type _Hash< _Traits >::insert ( _Valty &&  _Val)
inline
377  { // try to insert node with value _Val
378  _List.emplace_front(_STD forward<_Valty>(_Val));
379  return (_Insert(_List.front(), _Unchecked_begin()));
380  }
void emplace_front(_Valty &&..._Val)
Definition: list:1032
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
_Mylist _List
Definition: xhash:1041
reference front()
Definition: list:1254
_Unchecked_iterator _Unchecked_begin()
Definition: xhash:438
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Valty >
enable_if<is_convertible<_Valty, value_type>::value, iterator>::type _Hash< _Traits >::insert ( const_iterator  ,
_Valty &&  _Val 
)
inline
386  { // try to insert node with value _Val, ignore hint
387  _List.emplace_front(_STD forward<_Valty>(_Val));
388  return (_Insert(_List.front(), _Unchecked_begin()).first);
389  }
void emplace_front(_Valty &&..._Val)
Definition: list:1032
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
_Mylist _List
Definition: xhash:1041
reference front()
Definition: list:1254
_Unchecked_iterator _Unchecked_begin()
Definition: xhash:438
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
_Pairib _Hash< _Traits >::insert ( const value_type _Val)
inline
658  { // try to insert node with value _Val
659  return (_Insert(_Val, _Nil_obj));
660  }
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
static _Nil _Nil_obj
Definition: xtr1common:29
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
iterator _Hash< _Traits >::insert ( const_iterator  ,
const value_type _Val 
)
inline
664  { // try to insert node with value _Val, ignore hint
665  return (_Insert(_Val, _Nil_obj).first);
666  }
_Pairib _Insert(_Valty &&_Val, _Nodety _Pnode)
Definition: xhash:860
static _Nil _Nil_obj
Definition: xtr1common:29
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Traits>
template<class _Iter >
void _Hash< _Traits >::insert ( _Iter  _First,
_Iter  _Last 
)
inline
670  { // insert [_First, _Last) at front, then put in place
671  _DEBUG_RANGE(_First, _Last);
672  for (; _First != _Last; ++_First)
673 
674  emplace(*_First);
675  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:467
_Pairib emplace(_Valty &&..._Val)
Definition: xhash:392
_FwdIt _Last
Definition: algorithm:1936
template<class _Traits>
void _Hash< _Traits >::insert ( _XSTD initializer_list< value_type _Ilist)
inline
678  { // insert initializer_list
679  insert(_Ilist.begin(), _Ilist.end());
680  }
_Pairib insert(value_type &&_Val)
Definition: xhash:363
template<class _Traits>
key_compare _Hash< _Traits >::key_comp ( ) const
inline
529  { // return object for comparing keys
530  return (*this);
531  }
template<class _Traits>
float _Hash< _Traits >::load_factor ( ) const
inline
616  { // return elements per bucket
617  return ((float)size() / (float)bucket_count());
618  }
size_type size() const _NOEXCEPT
Definition: xhash:508
size_type bucket_count() const _NOEXCEPT
Definition: xhash:542
template<class _Traits>
iterator _Hash< _Traits >::lower_bound ( const key_type _Keyval)
inline
740  { // find leftmost not less than _Keyval in mutable hash table
741  size_type _Bucket = _Hashval(_Keyval);
742  for (_Unchecked_iterator _Where = _Begin(_Bucket);
743  _Where != _End(_Bucket); ++_Where)
744  if (!((_Traits&)*this)(this->_Kfn(*_Where), _Keyval))
745  return (((_Traits&)*this)(_Keyval,
746  this->_Kfn(*_Where)) ? end() : _Make_iter(_Where));
747  return (end());
748  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
const_iterator _Hash< _Traits >::lower_bound ( const key_type _Keyval) const
inline
751  { // find leftmost not less than _Keyval in nonmutable hash table
752  size_type _Bucket = _Hashval(_Keyval);
753  for (_Unchecked_const_iterator _Where = _Begin(_Bucket);
754  _Where != _End(_Bucket); ++_Where)
755  if (!((_Traits&)*this)(this->_Kfn(*_Where), _Keyval))
756  return (((_Traits&)*this)(_Keyval,
757  this->_Kfn(*_Where)) ? end() : _Make_iter(_Where));
758  return (end());
759  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
template<class _Traits>
size_type _Hash< _Traits >::max_bucket_count ( ) const
inline
548  { // return maximum number of buckets
549  return (_Vec.size() / 2);
550  }
size_type size() const _NOEXCEPT
Definition: vector:1146
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
float _Hash< _Traits >::max_load_factor ( ) const
inline
621  { // return maximum elements per bucket
622  return (_Max_bucket_size);
623  }
float _Max_bucket_size
Definition: xhash:1045
template<class _Traits>
void _Hash< _Traits >::max_load_factor ( float  _Newmax)
inline
626  { // set new load factor
627  if (_Newmax != _Newmax // may detect a NaN
628  || _Newmax < 0)
629  _Xout_of_range("invalid hash load factor");
630 
631  _Max_bucket_size = _Newmax;
632  }
float _Max_bucket_size
Definition: xhash:1045
template<class _Traits>
size_type _Hash< _Traits >::max_size ( ) const
inline
514  { // return maximum possible length of sequence
515  return (_List.max_size());
516  }
_Mylist _List
Definition: xhash:1041
size_type max_size() const _NOEXCEPT
Definition: list:1239
template<class _Traits>
_Myt& _Hash< _Traits >::operator= ( _Myt &&  _Right)
inline
351  { // assign by moving _Right
352  if (this != &_Right)
353  _Assign_rv(_STD forward<_Myt>(_Right));
354  return (*this);
355  }
void _Assign_rv(_Myt &&_Right)
Definition: xhash:357
const _Ty & _Right
Definition: algorithm:4087
template<class _Traits>
_Myt& _Hash< _Traits >::operator= ( const _Myt _Right)
inline
412  { // replace contents from _Right
413  if (this != &_Right)
414  _Copy(_Right);
415  return (*this);
416  }
void _Copy(const _Myt &_Right)
Definition: xhash:979
const _Ty & _Right
Definition: algorithm:4087
template<class _Traits>
reverse_iterator _Hash< _Traits >::rbegin ( )
inline
469  { // return iterator for beginning of reversed mutable sequence
470  return (_List.rbegin());
471  }
reverse_iterator rbegin() _NOEXCEPT
Definition: list:1166
_Mylist _List
Definition: xhash:1041
template<class _Traits>
const_reverse_iterator _Hash< _Traits >::rbegin ( ) const
inline
474  { // return iterator for beginning of reversed nonmutable sequence
475  return (_List.rbegin());
476  }
reverse_iterator rbegin() _NOEXCEPT
Definition: list:1166
_Mylist _List
Definition: xhash:1041
template<class _Traits>
void _Hash< _Traits >::rehash ( size_type  _Buckets)
inline
635  { // rebuild table with at least _Buckets buckets
636  size_type _Maxsize = _Vec.max_size() / 4;
637  size_type _Newsize = _Min_buckets;
638 
639  for (; _Newsize < _Buckets && _Newsize < _Maxsize; )
640  _Newsize *= 2; // double until big enough
641  if (_Newsize < _Buckets)
642  _Xout_of_range("invalid hash bucket count");
643  for (float _Size = (float)size();
644  max_load_factor() < _Size / _Newsize && _Newsize < _Maxsize; )
645  _Newsize *= 2; // double until load factor okay
646 
647  _Init(_Newsize);
648  _Reinsert();
649  }
Definition: xhash:265
size_type size() const _NOEXCEPT
Definition: xhash:508
size_type max_size() const _NOEXCEPT
Definition: vector:1151
void _Reinsert()
Definition: xhash:1027
_Mylist::size_type size_type
Definition: xhash:273
float max_load_factor() const _NOEXCEPT
Definition: xhash:620
_Check_return_ _In_ long _Size
Definition: io.h:325
void _Init(size_type _Buckets=_Min_buckets)
Definition: xhash:1004
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
reverse_iterator _Hash< _Traits >::rend ( )
inline
479  { // return iterator for end of reversed mutable sequence
480  return (_List.rend());
481  }
_Mylist _List
Definition: xhash:1041
reverse_iterator rend() _NOEXCEPT
Definition: list:1176
template<class _Traits>
const_reverse_iterator _Hash< _Traits >::rend ( ) const
inline
484  { // return iterator for end of reversed nonmutable sequence
485  return (_List.rend());
486  }
_Mylist _List
Definition: xhash:1041
reverse_iterator rend() _NOEXCEPT
Definition: list:1176
template<class _Traits>
void _Hash< _Traits >::reserve ( size_type  _Maxcount)
inline
652  { // rebuild table with room for _Maxcount elements
653  rehash((size_type)((float)(_Maxcount / max_load_factor() + 0.5F)));
654  }
_Mylist::size_type size_type
Definition: xhash:273
float max_load_factor() const _NOEXCEPT
Definition: xhash:620
void rehash(size_type _Buckets)
Definition: xhash:634
template<class _Traits>
size_type _Hash< _Traits >::size ( ) const
inline
509  { // return length of sequence
510  return (_List.size());
511  }
_Mylist _List
Definition: xhash:1041
size_type size() const _NOEXCEPT
Definition: list:1234
template<class _Traits>
void _Hash< _Traits >::swap ( _Myt _Right)
inline
822  { // exchange contents with _Right
823  if (this != &_Right)
824  { // different, worth swapping
825  _Swap_adl((_Traits&)*this, (_Traits&)_Right);
826  this->_List.swap(_Right._List);
827  this->_Vec.swap(_Right._Vec);
828  _STD swap(this->_Mask, _Right._Mask);
829  _STD swap(this->_Maxidx, _Right._Maxidx);
830  _STD swap(this->_Max_bucket_size, _Right._Max_bucket_size);
831  }
832  }
size_type _Mask
Definition: xhash:1043
void swap(_Myt &_Right)
Definition: list:1508
float _Max_bucket_size
Definition: xhash:1045
void swap(_Myt &_Right)
Definition: vector:1513
_Mylist _List
Definition: xhash:1041
void swap(_Myt &_Right)
Definition: xhash:821
size_type _Maxidx
Definition: xhash:1044
const _Ty & _Right
Definition: algorithm:4087
_Myvec _Vec
Definition: xhash:1042
template<class _Traits>
iterator _Hash< _Traits >::upper_bound ( const key_type _Keyval)
inline
762  { // find leftmost not greater than _Keyval in mutable hash table
763  size_type _Bucket = _Hashval(_Keyval);
764  for (_Unchecked_iterator _Where = _End(_Bucket);
765  _Where != _Begin(_Bucket); )
766  if (!((_Traits&)*this)(_Keyval, this->_Kfn(*--_Where)))
767  return (((_Traits&)*this)(this->_Kfn(*_Where),
768  _Keyval) ? end() : _Make_iter(++_Where));
769  return (end());
770  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
_If< is_same< key_type, value_type >::value, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator >::type _Unchecked_iterator
Definition: xhash:288
template<class _Traits>
const_iterator _Hash< _Traits >::upper_bound ( const key_type _Keyval) const
inline
773  { // find leftmost not greater than _Keyval in nonmutable hash table
774  size_type _Bucket = _Hashval(_Keyval);
775  for (_Unchecked_const_iterator _Where = _End(_Bucket);
776  _Where != _Begin(_Bucket); )
777  if (!((_Traits&)*this)(_Keyval, this->_Kfn(*--_Where)))
778  return (((_Traits&)*this)(this->_Kfn(*_Where),
779  _Keyval) ? end() : _Make_iter(++_Where));
780  return (end());
781  }
iterator _Make_iter(_Unchecked_const_iterator _Where) const
Definition: xhash:458
_Mylist::_Unchecked_const_iterator _Unchecked_const_iterator
Definition: xhash:290
_Unchecked_iterator _End(size_type _Bucket)
Definition: xhash:929
iterator end() _NOEXCEPT
Definition: xhash:428
_Mylist::size_type size_type
Definition: xhash:273
_Unchecked_iterator _Begin(size_type _Bucket)
Definition: xhash:919
size_type _Hashval(const key_type &_Keyval) const
Definition: xhash:996
template<class _Traits>
value_compare _Hash< _Traits >::value_comp ( ) const
inline
534  { // return object for comparing values
535  return (value_compare(key_comp()));
536  }
key_compare key_comp() const
Definition: xhash:528
_Traits::value_compare value_compare
Definition: xhash:261

Member Data Documentation

template<class _Traits>
_Mylist _Hash< _Traits >::_List
protected
template<class _Traits>
size_type _Hash< _Traits >::_Mask
protected
template<class _Traits>
float _Hash< _Traits >::_Max_bucket_size
protected
template<class _Traits>
size_type _Hash< _Traits >::_Maxidx
protected
template<class _Traits>
_Myvec _Hash< _Traits >::_Vec
protected

The documentation for this class was generated from the following file: