STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Concurrency::details::_Concurrent_hash< _Traits > Class Template Reference

#include <internal_concurrent_hash.h>

Inheritance diagram for Concurrency::details::_Concurrent_hash< _Traits >:

Public Types

typedef _Concurrent_hash< _Traits > _Mytype
 
typedef _Split_ordered_list< typename _Traits::value_type, typename _Traits::allocator_type > _Mylist
 
typedef _Traits::_Key_compare _Key_compare
 
typedef _Traits::_Value_compare _Value_compare
 
typedef _Traits::value_type value_type
 
typedef _Traits::key_type key_type
 
typedef _Traits::allocator_type allocator_type
 
typedef allocator_type::pointer pointer
 
typedef allocator_type::const_pointer const_pointer
 
typedef allocator_type::reference reference
 
typedef allocator_type::const_reference const_reference
 
typedef allocator_type::size_type size_type
 
typedef allocator_type::difference_type difference_type
 
typedef std::conditional< std::is_same< key_type, value_type >::value, typename _Mylist::const_iterator, typename _Mylist::iterator >::type iterator
 
typedef _Mylist::const_iterator const_iterator
 
typedef iterator local_iterator
 
typedef const_iterator const_local_iterator
 
typedef _Mylist::_Nodeptr _Nodeptr
 
typedef _Mylist::_Full_iterator _Full_iterator
 
typedef _Mylist::_Full_const_iterator _Full_const_iterator
 

Public Member Functions

 _Concurrent_hash (size_type _Number_of_buckets=_Initial_bucket_number, const _Key_compare &_Parg=_Key_compare(), const allocator_type &_Allocator=allocator_type())
 
 _Concurrent_hash (const _Concurrent_hash &_Right, const allocator_type &_Allocator)
 
 _Concurrent_hash (const _Concurrent_hash &_Right)
 
 _Concurrent_hash (_Concurrent_hash &&_Right)
 
_Concurrent_hashoperator= (const _Concurrent_hash &_Right)
 
_Concurrent_hashoperator= (_Concurrent_hash &&_Right)
 
 ~_Concurrent_hash ()
 
allocator_type get_allocator () const
 Returns the stored allocator object for this concurrent container. This method is concurrency safe. More...
 
bool empty () const
 Tests whether no elements are present. This method is concurrency safe. More...
 
size_type size () const
 Returns the number of elements in this concurrent container. This method is concurrency safe. More...
 
size_type max_size () const
 Returns the maximum size of the concurrent container, determined by the allocator. This method is concurrency safe. More...
 
iterator begin ()
 Returns an iterator pointing to the first element in the concurrent container. This method is concurrency safe. More...
 
const_iterator begin () const
 Returns an iterator pointing to the first element in the concurrent container. This method is concurrency safe. More...
 
iterator end ()
 Returns an iterator pointing to the location succeeding the last element in the concurrent container. This method is concurrency safe. More...
 
const_iterator end () const
 Returns a const_iterator pointing to the location succeeding the last element in the concurrent container. This method is concurrency safe. More...
 
const_iterator cbegin () const
 Returns a const iterator pointing to the first element in the concurrent container. This method is concurrency safe. More...
 
const_iterator cend () const
 Returns a const iterator pointing to the location succeeding the last element in the concurrent container. This method is concurrency safe. More...
 
iterator unsafe_erase (const_iterator _Where)
 Removes elements from the container at specified positions. This method is not concurrency-safe. More...
 
iterator unsafe_erase (const_iterator _First, const_iterator _Last)
 Removes elements from the container at specified positions. This method is not concurrency-safe. More...
 
size_type unsafe_erase (const key_type &_Keyval)
 Removes elements from the container at specified positions. This method is not concurrency-safe. More...
 
void swap (_Concurrent_hash &_Right)
 Swaps the contents of two concurrent containers. This function is not concurrency safe. More...
 
void clear ()
 Erases all the elements in the concurrent container. This function is not concurrency safe. More...
 
iterator find (const key_type &_Keyval)
 Finds an element that matches a specified key. This function is concurrency safe. More...
 
const_iterator find (const key_type &_Keyval) const
 Finds an element that matches a specified key. This function is concurrency safe. More...
 
size_type count (const key_type &_Keyval) const
 Counts the number of elements matching a specified key. This function is concurrency safe. More...
 
std::pair< iterator, iteratorequal_range (const key_type &_Keyval)
 Finds a range that matches a specified key. This function is concurrency safe. More...
 
std::pair< const_iterator, const_iteratorequal_range (const key_type &_Keyval) const
 Finds a range that matches a specified key. This function is concurrency safe. More...
 
size_type unsafe_bucket_count () const
 Returns the current number of buckets in this container. More...
 
size_type unsafe_max_bucket_count () const
 Returns the maximum number of buckets in this container. More...
 
size_type unsafe_bucket_size (size_type _Bucket)
 Returns the number of items in a specific bucket of this container. More...
 
size_type unsafe_bucket (const key_type &_Keyval) const
 Returns the bucket index that a specific key maps to in this container. More...
 
local_iterator unsafe_begin (size_type _Bucket)
 Returns an iterator to the first element in this container for a specific bucket. More...
 
const_local_iterator unsafe_begin (size_type _Bucket) const
 Returns an iterator to the first element in this container for a specific bucket. More...
 
local_iterator unsafe_end (size_type _Bucket)
 Returns an iterator to the last element in this container for a specific bucket. More...
 
const_local_iterator unsafe_end (size_type _Bucket) const
 Returns an iterator to the last element in this container for a specific bucket. More...
 
const_local_iterator unsafe_cbegin (size_type) const
 Returns an iterator to the first element in this container for a specific bucket. More...
 
const_local_iterator unsafe_cend (size_type) const
 Returns an iterator to the first element in this container for a specific bucket. More...
 
float load_factor () const
 Computes and returns the current load factor of the container. The load factor is the number of elements in the container divided by the number of buckets. More...
 
float max_load_factor () const
 Gets or sets the maximum load factor of the container. The maximum load factor is the largest number of elements than can be in any bucket before the container grows its internal table. More...
 
void max_load_factor (float _Newmax)
 Gets or sets the maximum load factor of the container. The maximum load factor is the largest number of elements than can be in any bucket before the container grows its internal table. More...
 
void rehash (size_type _Buckets)
 Rebuilds the hash table. More...
 

Static Public Member Functions

static size_type __cdecl _Segment_index_of (size_type _Index)
 
static size_type _Segment_base (size_type _K)
 
static size_type _Segment_size (size_type _K)
 

Static Public Attributes

static const size_type _Initial_bucket_number = 8
 
static const size_type _Initial_bucket_load = 4
 
static size_type const _Pointers_per_table = sizeof(size_type) * 8
 

Protected Member Functions

template<typename _ValTy >
std::pair< iterator, bool_Insert (_ValTy &&_Value)
 
template<class _Iterator >
void _Insert (_Iterator _First, _Iterator _Last)
 

Private Member Functions

void _Init ()
 
void _Copy (const _Mytype &_Right)
 
void _Swap_buckets (_Concurrent_hash &_Right)
 
size_type _Distance (const_iterator _First, const_iterator _Last) const
 
iterator _Find (const key_type &_Keyval)
 
const_iterator _Find (const key_type &_Keyval) const
 
iterator _Erase (const_iterator _Iterator)
 
std::pair< iterator, iterator_Equal_range (const key_type &_Keyval)
 
std::pair< const_iterator, const_iterator_Equal_range (const key_type &_Keyval) const
 
void _Initialize_bucket (size_type _Bucket)
 
void _Adjust_table_size (size_type _Total_elements, size_type _Current_size)
 
size_type _Get_parent (size_type _Bucket) const
 
_Full_iterator _Get_bucket (size_type _Bucket) const
 
void _Set_bucket (size_type _Bucket, _Full_iterator _Dummy_head)
 
bool _Is_initialized (size_type _Bucket) const
 
_Split_order_key _Reverse (_Map_key _Order_key) const
 
_Split_order_key _Split_order_regular_key (_Map_key _Order_key) const
 
_Split_order_key _Split_order_dummy_key (_Map_key _Order_key) const
 

Private Attributes

_Full_iterator_M_buckets [_Pointers_per_table]
 
_Mylist _M_split_ordered_list
 
allocator_type::template rebind< _Full_iterator >::other _M_allocator
 
size_type _M_number_of_buckets
 
float _M_maximum_bucket_size
 

Member Typedef Documentation

template<typename _Traits>
typedef _Mylist::_Full_iterator Concurrency::details::_Concurrent_hash< _Traits >::_Full_iterator
template<typename _Traits>
typedef _Traits::_Key_compare Concurrency::details::_Concurrent_hash< _Traits >::_Key_compare
template<typename _Traits>
typedef _Split_ordered_list<typename _Traits::value_type, typename _Traits::allocator_type> Concurrency::details::_Concurrent_hash< _Traits >::_Mylist
template<typename _Traits>
typedef _Concurrent_hash<_Traits> Concurrency::details::_Concurrent_hash< _Traits >::_Mytype
template<typename _Traits>
typedef _Mylist::_Nodeptr Concurrency::details::_Concurrent_hash< _Traits >::_Nodeptr
template<typename _Traits>
typedef _Traits::_Value_compare Concurrency::details::_Concurrent_hash< _Traits >::_Value_compare
template<typename _Traits>
typedef _Traits::allocator_type Concurrency::details::_Concurrent_hash< _Traits >::allocator_type
template<typename _Traits>
typedef _Mylist::const_iterator Concurrency::details::_Concurrent_hash< _Traits >::const_iterator
template<typename _Traits>
typedef const_iterator Concurrency::details::_Concurrent_hash< _Traits >::const_local_iterator
template<typename _Traits>
typedef allocator_type::const_pointer Concurrency::details::_Concurrent_hash< _Traits >::const_pointer
template<typename _Traits>
typedef allocator_type::const_reference Concurrency::details::_Concurrent_hash< _Traits >::const_reference
template<typename _Traits>
typedef allocator_type::difference_type Concurrency::details::_Concurrent_hash< _Traits >::difference_type
template<typename _Traits>
typedef std::conditional<std::is_same<key_type, value_type>::value, typename _Mylist::const_iterator, typename _Mylist::iterator>::type Concurrency::details::_Concurrent_hash< _Traits >::iterator
template<typename _Traits>
typedef _Traits::key_type Concurrency::details::_Concurrent_hash< _Traits >::key_type
template<typename _Traits>
typedef iterator Concurrency::details::_Concurrent_hash< _Traits >::local_iterator
template<typename _Traits>
typedef allocator_type::pointer Concurrency::details::_Concurrent_hash< _Traits >::pointer
template<typename _Traits>
typedef allocator_type::reference Concurrency::details::_Concurrent_hash< _Traits >::reference
template<typename _Traits>
typedef allocator_type::size_type Concurrency::details::_Concurrent_hash< _Traits >::size_type
template<typename _Traits>
typedef _Traits::value_type Concurrency::details::_Concurrent_hash< _Traits >::value_type

Constructor & Destructor Documentation

template<typename _Traits>
Concurrency::details::_Concurrent_hash< _Traits >::_Concurrent_hash ( size_type  _Number_of_buckets = _Initial_bucket_number,
const _Key_compare _Parg = _Key_compare(),
const allocator_type _Allocator = allocator_type() 
)
inline
125  : _Traits(_Parg), _M_number_of_buckets(_Number_of_buckets), _M_split_ordered_list(_Allocator), _M_allocator(_Allocator), _M_maximum_bucket_size((float) _Initial_bucket_load)
126  {
127  _Init();
128  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
static const size_type _Initial_bucket_load
Definition: internal_concurrent_hash.h:120
void _Init()
Definition: internal_concurrent_hash.h:937
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
template<typename _Traits>
Concurrency::details::_Concurrent_hash< _Traits >::_Concurrent_hash ( const _Concurrent_hash< _Traits > &  _Right,
const allocator_type _Allocator 
)
inline
130  : _Traits(_Right._M_comparator), _M_split_ordered_list(_Allocator), _M_allocator(_Allocator)
131  {
132  _Copy(_Right);
133  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
void _Copy(const _Mytype &_Right)
Definition: internal_concurrent_hash.h:947
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
Concurrency::details::_Concurrent_hash< _Traits >::_Concurrent_hash ( const _Concurrent_hash< _Traits > &  _Right)
inline
135  : _Traits(_Right._M_comparator), _M_split_ordered_list(_Right.get_allocator()), _M_allocator(_Right.get_allocator())
136  {
137  _Init();
138  _Copy(_Right);
139  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
void _Copy(const _Mytype &_Right)
Definition: internal_concurrent_hash.h:947
void _Init()
Definition: internal_concurrent_hash.h:937
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
Concurrency::details::_Concurrent_hash< _Traits >::_Concurrent_hash ( _Concurrent_hash< _Traits > &&  _Right)
inline
141  : _Traits(_Right._M_comparator), _M_split_ordered_list(_Right.get_allocator()), _M_allocator(_Right.get_allocator()),
143  {
144  _Init();
145  swap(_Right);
146  }
static const size_type _Initial_bucket_number
Definition: internal_concurrent_hash.h:119
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
static const size_type _Initial_bucket_load
Definition: internal_concurrent_hash.h:120
void swap(_Concurrent_hash &_Right)
Swaps the contents of two concurrent containers. This function is not concurrency safe...
Definition: internal_concurrent_hash.h:424
void _Init()
Definition: internal_concurrent_hash.h:937
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
Concurrency::details::_Concurrent_hash< _Traits >::~_Concurrent_hash ( )
inline
170  {
171  // Delete all node segments
173  {
174  if (_M_buckets[_Index] != NULL)
175  {
176  size_type _Seg_size = _Segment_size(_Index);
177  for (size_type _Index2 = 0; _Index2 < _Seg_size; _Index2++)
178  {
179  _M_allocator.destroy(&_M_buckets[_Index][_Index2]);
180  }
181  _M_allocator.deallocate(_M_buckets[_Index], _Seg_size);
182  }
183  }
184  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
static size_type _Segment_size(size_type _K)
Definition: internal_concurrent_hash.h:196
_In_ size_t _In_ int _Index
Definition: time.h:102
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
#define NULL
Definition: corecrt.h:158

Member Function Documentation

template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Adjust_table_size ( size_type  _Total_elements,
size_type  _Current_size 
)
inlineprivate
1219  {
1220  // Grow the table by a factor of 2 if possible and needed
1221  if (((float) _Total_elements / (float) _Current_size) > _M_maximum_bucket_size)
1222  {
1223  // Double the size of the hash only if size has not changed inbetween loads
1224  _InterlockedCompareExchangeSizeT(&_M_number_of_buckets, 2 * _Current_size, _Current_size);
1225  }
1226  }
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
#define _InterlockedCompareExchangeSizeT(_Target, _Exchange, _Comparand)
Definition: concrt.h:98
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Copy ( const _Mytype _Right)
inlineprivate
948  {
949  clear();
950 
951  _M_maximum_bucket_size = _Right._M_maximum_bucket_size;
952  _M_number_of_buckets = _Right._M_number_of_buckets;
953 
954  try
955  {
956  _Insert(_Right.begin(), _Right.end());
957  this->_M_comparator = _Right._M_comparator;
958  }
959  catch(...)
960  {
962  throw;
963  }
964  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
void clear()
Erases all the elements in the concurrent container. This function is not concurrency safe...
Definition: internal_concurrent_hash.h:440
std::pair< iterator, bool > _Insert(_ValTy &&_Value)
Definition: internal_concurrent_hash.h:861
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
void clear()
Definition: internal_split_ordered_list.h:412
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::_Distance ( const_iterator  _First,
const_iterator  _Last 
) const
inlineprivate
986  {
987  size_type _Num = 0;
988 
989  for (const_iterator _Iterator = _First; _Iterator != _Last; _Iterator++)
990  {
991  _Num++;
992  }
993 
994  return _Num;
995  }
_Mylist::const_iterator const_iterator
Definition: internal_concurrent_hash.h:109
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
std::pair<iterator, iterator> Concurrency::details::_Concurrent_hash< _Traits >::_Equal_range ( const key_type _Keyval)
inlineprivate
1117  {
1118  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(_Keyval);
1119  size_type _Bucket = _Order_key % _M_number_of_buckets;
1120 
1121  // If _Bucket is empty, initialize it first
1122  if (!_Is_initialized(_Bucket))
1123  {
1124  _Initialize_bucket(_Bucket);
1125  }
1126 
1127  _Order_key = _Split_order_regular_key(_Order_key);
1129 
1130  for (_Full_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1131  {
1132  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1133  {
1134  // There is no element with the given key
1135  return std::pair<iterator, iterator>(end(), end());
1136  }
1137  else if (_Mylist::_Get_key(_Iterator) == _Order_key && !this->_M_comparator(this->_Key_function(*_Iterator), _Keyval))
1138  {
1139  iterator _Begin = _M_split_ordered_list._Get_iterator(_Iterator);
1140  iterator _End= _Begin;
1141 
1142  for (;_End != end() && !this->_M_comparator(this->_Key_function(*_End), _Keyval); _End++)
1143  {
1144  }
1145 
1146  return std::pair<iterator, iterator>(_Begin, _End);
1147  }
1148  }
1149 
1150  return std::pair<iterator, iterator>(end(), end());
1151  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1294
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:536
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
Definition: xutility:565
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
std::pair<const_iterator, const_iterator> Concurrency::details::_Concurrent_hash< _Traits >::_Equal_range ( const key_type _Keyval) const
inlineprivate
1156  {
1157  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(_Keyval);
1158  size_type _Bucket = _Order_key % _M_number_of_buckets;
1159 
1160  // If _Bucket has not been initialized, keep searching up for a parent bucket
1161  // that has been initialized. Worst case is the entire map will be read.
1162  while (!_Is_initialized(_Bucket))
1163  {
1164  _Bucket = _Get_parent(_Bucket);
1165  }
1166 
1167  _Order_key = _Split_order_regular_key(_Order_key);
1169 
1170  for (_Full_const_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1171  {
1172  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1173  {
1174  // There is no element with the given key
1175  return std::pair<const_iterator, const_iterator>(end(), end());
1176  }
1177  else if (_Mylist::_Get_key(_Iterator) == _Order_key && !this->_M_comparator(this->_Key_function(*_Iterator), _Keyval))
1178  {
1180  const_iterator _End = _Begin;
1181 
1182  for (; _End != end() && !this->_M_comparator(this->_Key_function(*_End), _Keyval); _End++)
1183  {
1184  }
1185 
1186  return std::pair<const_iterator, const_iterator>(_Begin, _End);
1187  }
1188  }
1189 
1190  return std::pair<const_iterator, const_iterator>(end(), end());
1191  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1294
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
_Mylist::_Full_const_iterator _Full_const_iterator
Definition: internal_concurrent_hash.h:117
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:536
_Mylist::const_iterator const_iterator
Definition: internal_concurrent_hash.h:109
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
size_type _Get_parent(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1228
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::_Erase ( const_iterator  _Iterator)
inlineprivate
1076  {
1077  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(this->_Key_function(*_Iterator));
1078  size_type _Bucket = _Order_key % _M_number_of_buckets;
1079 
1080  // If bucket is empty, initialize it first
1081  if (!_Is_initialized(_Bucket))
1082  {
1083  _Initialize_bucket(_Bucket);
1084  }
1085 
1086  _Order_key = _Split_order_regular_key(_Order_key);
1087 
1088  _Full_iterator _Previous = _Get_bucket(_Bucket);
1090  _Full_iterator _Where = _Previous;
1091 
1092  _ASSERT_EXPR(_Where != _Last, L"Invalid head node");
1093 
1094  // First node is a dummy node
1095  _Where++;
1096 
1097  for (;;)
1098  {
1099  if (_Where == _Last)
1100  {
1101  return end();
1102  }
1103  else if (_M_split_ordered_list._Get_iterator(_Where) == _Iterator)
1104  {
1105  return _M_split_ordered_list._Erase(_Previous, _Iterator);
1106  }
1107 
1108  // Move the iterator forward
1109  _Previous = _Where;
1110  _Where++;
1111  }
1112  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1294
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
void _Erase(_Nodeptr _Delete_node)
Definition: internal_split_ordered_list.h:596
#define _ASSERT_EXPR(expr, msg)
Definition: crtdbg.h:699
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::_Find ( const key_type _Keyval)
inlineprivate
999  {
1000  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(_Keyval);
1001  size_type _Bucket = _Order_key % _M_number_of_buckets;
1002 
1003  // If _Bucket is empty, initialize it first
1004  if (!_Is_initialized(_Bucket))
1005  {
1006  _Initialize_bucket(_Bucket);
1007  }
1008 
1009  _Order_key = _Split_order_regular_key(_Order_key);
1011 
1012  for (_Full_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1013  {
1014  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1015  {
1016  // If the order key is smaller than the current order key, the element
1017  // is not in the hash.
1018  return end();
1019  }
1020  else if (_Mylist::_Get_key(_Iterator) == _Order_key)
1021  {
1022  // The fact that order keys match does not mean that the element is found.
1023  // Key function comparison has to be performed to check whether this is the
1024  // right element. If not, keep searching while order key is the same.
1025  if (!this->_M_comparator(this->_Key_function(*_Iterator), _Keyval))
1026  {
1027  return _M_split_ordered_list._Get_iterator(_Iterator);
1028  }
1029  }
1030  }
1031 
1032  return end();
1033  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1294
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:536
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::_Find ( const key_type _Keyval) const
inlineprivate
1037  {
1038  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(_Keyval);
1039  size_type _Bucket = _Order_key % _M_number_of_buckets;
1040 
1041  // If _Bucket has not been initialized, keep searching up for a parent bucket
1042  // that has been initialized. Worst case is the entire map will be read.
1043  while (!_Is_initialized(_Bucket))
1044  {
1045  _Bucket = _Get_parent(_Bucket);
1046  }
1047 
1048  _Order_key = _Split_order_regular_key(_Order_key);
1050 
1051  for (_Full_const_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1052  {
1053  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1054  {
1055  // If the order key is smaller than the current order key, the element
1056  // is not in the hash.
1057  return end();
1058  }
1059  else if (_Mylist::_Get_key(_Iterator) == _Order_key)
1060  {
1061  // The fact that order keys match does not mean that the element is found.
1062  // Key function comparison has to be performed to check whether this is the
1063  // right element. If not, keep searching while order key is the same.
1064  if (!this->_M_comparator(this->_Key_function(*_Iterator), _Keyval))
1065  {
1066  return _M_split_ordered_list._Get_iterator(_Iterator);
1067  }
1068  }
1069  }
1070 
1071  return end();
1072  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1294
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
_Mylist::_Full_const_iterator _Full_const_iterator
Definition: internal_concurrent_hash.h:117
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:536
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
size_type _Get_parent(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1228
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
_Full_iterator Concurrency::details::_Concurrent_hash< _Traits >::_Get_bucket ( size_type  _Bucket) const
inlineprivate
1237  {
1238  size_type _Segment = _Segment_index_of(_Bucket);
1239  _Bucket -= _Segment_base(_Segment);
1240  return _M_buckets[_Segment][_Bucket];
1241  }
static size_type _Segment_base(size_type _K)
Definition: internal_concurrent_hash.h:191
static size_type __cdecl _Segment_index_of(size_type _Index)
Definition: internal_concurrent_hash.h:186
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::_Get_parent ( size_type  _Bucket) const
inlineprivate
1229  {
1230  // Unsets bucket's most significant turned-on bit
1231  unsigned char _Msb = _Get_msb(_Bucket);
1232  return _Bucket & ~(1 << _Msb);
1233  }
unsigned char _Get_msb(size_t _Mask)
Definition: internal_concurrent_hash.h:71
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Init ( )
inlineprivate
938  {
939  // Allocate an array of segment pointers
940  memset(_M_buckets, 0, _Pointers_per_table * sizeof(void *));
941 
942  // Insert the first element in the split-ordered list
944  _Set_bucket(0, _Dummy_node);
945  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
_Full_iterator _Begin()
Definition: internal_split_ordered_list.h:515
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
void _Set_bucket(size_type _Bucket, _Full_iterator _Dummy_head)
Definition: internal_concurrent_hash.h:1243
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Initialize_bucket ( size_type  _Bucket)
inlineprivate
1195  {
1196  // Bucket 0 has no parent. Initialize it and return.
1197  if (_Bucket == 0)
1198  {
1199  _Init();
1200  return;
1201  }
1202 
1203  size_type _Parent_bucket = _Get_parent(_Bucket);
1204 
1205  // All _Parent_bucket buckets have to be initialized before this bucket is
1206  if (!_Is_initialized(_Parent_bucket))
1207  {
1208  _Initialize_bucket(_Parent_bucket);
1209  }
1210 
1211  _Full_iterator _Parent = _Get_bucket(_Parent_bucket);
1212 
1213  // Create a dummy first node in this bucket
1215  _Set_bucket(_Bucket, _Dummy_node);
1216  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
_Full_iterator _Insert_dummy(_Full_iterator _Iterator, _Split_order_key _Order_key)
Definition: internal_split_ordered_list.h:633
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
void _Init()
Definition: internal_concurrent_hash.h:937
_Split_order_key _Split_order_dummy_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1300
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
void _Set_bucket(size_type _Bucket, _Full_iterator _Dummy_head)
Definition: internal_concurrent_hash.h:1243
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _Get_parent(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1228
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
template<typename _ValTy >
std::pair<iterator, bool> Concurrency::details::_Concurrent_hash< _Traits >::_Insert ( _ValTy &&  _Value)
inlineprotected
862  {
863  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(this->_Key_function(_Value));
864  size_type _Bucket = _Order_key % _M_number_of_buckets;
865 
866  // If bucket is empty, initialize it first
867  if (!_Is_initialized(_Bucket))
868  {
869  _Initialize_bucket(_Bucket);
870  }
871 
872  long _New_count;
873  _Order_key = _Split_order_regular_key(_Order_key);
874  _Full_iterator _Iterator = _Get_bucket(_Bucket);
876  _Full_iterator _Where = _Iterator;
877  _Nodeptr _New_node = _M_split_ordered_list._Buynode(_Order_key, std::forward<_ValTy>(_Value));
878 
879  _ASSERT_EXPR(_Where != _Last, L"Invalid head node");
880 
881  // First node is a dummy node
882  _Where++;
883 
884  for (;;)
885  {
886  if (_Where == _Last || _Mylist::_Get_key(_Where) > _Order_key)
887  {
888  // Try to insert it in the right place
889  std::pair<iterator, bool> _Result = _M_split_ordered_list._Insert(_Iterator, _Where, _New_node, &_New_count);
890 
891  if (_Result.second)
892  {
893  // Insertion succeeded, adjust the table size, if needed
895  return _Result;
896  }
897  else
898  {
899  // Insertion failed: either the same node was inserted by another thread, or
900  // another element was inserted at exactly the same place as this node.
901  // Proceed with the search from the previous location where order key was
902  // known to be larger (note: this is legal only because there is no safe
903  // concurrent erase operation supported).
904  _Where = _Iterator;
905  _Where++;
906  continue;
907  }
908  }
909  else if (!this->_M_allow_multimapping && _Mylist::_Get_key(_Where) == _Order_key &&
910  this->_M_comparator(this->_Key_function(*_Where), this->_Key_function(_New_node->_M_element)) == 0)
911  {
912  // If the insert failed (element already there), then delete the new one
913  _M_split_ordered_list._Erase(_New_node);
914 
915  // Element already in the list, return it
916  return std::pair<iterator, bool>(_M_split_ordered_list._Get_iterator(_Where), false);
917  }
918 
919  // Move the iterator forward
920  _Iterator = _Where;
921  _Where++;
922  }
923  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1294
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:536
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
void _Erase(_Nodeptr _Delete_node)
Definition: internal_split_ordered_list.h:596
#define _ASSERT_EXPR(expr, msg)
Definition: crtdbg.h:699
_Nodeptr _Insert(_Nodeptr _Previous, _Nodeptr _New_node, _Nodeptr _Current_node)
Definition: internal_split_ordered_list.h:608
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
_Nodeptr _Buynode(_Split_order_key _Order_key, _ValTy &&_Value)
Definition: internal_split_ordered_list.h:322
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
_In_ _Value
Definition: corecrt_wstdlib.h:65
void _Adjust_table_size(size_type _Total_elements, size_type _Current_size)
Definition: internal_concurrent_hash.h:1218
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_Result
Definition: corecrt_wconio.h:362
_Mylist::_Nodeptr _Nodeptr
Definition: internal_concurrent_hash.h:113
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
template<class _Iterator >
void Concurrency::details::_Concurrent_hash< _Traits >::_Insert ( _Iterator  _First,
_Iterator  _Last 
)
inlineprotected
927  {
928  for (_Iterator _I = _First; _I != _Last; _I++)
929  {
930  _Insert(*_I);
931  }
932  }
std::pair< iterator, bool > _Insert(_ValTy &&_Value)
Definition: internal_concurrent_hash.h:861
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
bool Concurrency::details::_Concurrent_hash< _Traits >::_Is_initialized ( size_type  _Bucket) const
inlineprivate
1263  {
1264  size_type _Segment = _Segment_index_of(_Bucket);
1265  _Bucket -= _Segment_base(_Segment);
1266 
1267  if (_M_buckets[_Segment] == NULL)
1268  {
1269  return false;
1270  }
1271 
1272  _Full_iterator _Iterator = _M_buckets[_Segment][_Bucket];
1273  return (_Iterator._Mynode() != NULL);
1274  }
static size_type _Segment_base(size_type _K)
Definition: internal_concurrent_hash.h:191
static size_type __cdecl _Segment_index_of(size_type _Index)
Definition: internal_concurrent_hash.h:186
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
#define NULL
Definition: corecrt.h:158
template<typename _Traits>
_Split_order_key Concurrency::details::_Concurrent_hash< _Traits >::_Reverse ( _Map_key  _Order_key) const
inlineprivate
1278  {
1279  _Split_order_key _Reversed_order_key;
1280 
1281  unsigned char * _Original = (unsigned char *) &_Order_key;
1282  unsigned char * _Reversed = (unsigned char *) &_Reversed_order_key;
1283 
1284  int _Size = sizeof(_Map_key);
1285  for (int _Index = 0; _Index < _Size; _Index++)
1286  {
1287  _Reversed[_Size - _Index - 1] = _Reverse_byte(_Original[_Index]);
1288  }
1289 
1290  return _Reversed_order_key;
1291  }
size_t _Map_key
Definition: internal_split_ordered_list.h:194
_CRT_BEGIN_C_HEADER _Check_return_ _Ret_maybenull_ _In_ size_t _Size
Definition: corecrt_malloc.h:58
_In_ size_t _In_ int _Index
Definition: time.h:102
unsigned char _Reverse_byte(unsigned char _Original_byte)
Definition: internal_concurrent_hash.h:64
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
template<typename _Traits>
static size_type Concurrency::details::_Concurrent_hash< _Traits >::_Segment_base ( size_type  _K)
inlinestatic
192  {
193  return (size_type(1)<<_K & ~size_type(1));
194  }
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
static size_type __cdecl Concurrency::details::_Concurrent_hash< _Traits >::_Segment_index_of ( size_type  _Index)
inlinestatic
187  {
188  return size_type( _Get_msb( _Index|1 ) );
189  }
_In_ size_t _In_ int _Index
Definition: time.h:102
unsigned char _Get_msb(size_t _Mask)
Definition: internal_concurrent_hash.h:71
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
static size_type Concurrency::details::_Concurrent_hash< _Traits >::_Segment_size ( size_type  _K)
inlinestatic
197  {
198  return _K ? size_type(1)<<_K : 2;
199  }
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Set_bucket ( size_type  _Bucket,
_Full_iterator  _Dummy_head 
)
inlineprivate
1244  {
1245  size_type _Segment = _Segment_index_of(_Bucket);
1246  _Bucket -= _Segment_base(_Segment);
1247 
1248  if (_M_buckets[_Segment] == NULL)
1249  {
1250  size_type _Seg_size = _Segment_size(_Segment);
1251  _Full_iterator * _New_segment = _M_allocator.allocate(_Seg_size);
1252  std::_Wrap_alloc<decltype(_M_allocator)> _Wrapped_allocator(_M_allocator);
1253  std::_Uninitialized_default_fill_n(_New_segment, _Seg_size, _Wrapped_allocator);
1254  if (_InterlockedCompareExchangePointer((void * volatile *) &_M_buckets[_Segment], _New_segment, NULL) != NULL)
1255  {
1256  _M_allocator.deallocate(_New_segment, _Seg_size);
1257  }
1258  }
1259  _M_buckets[_Segment][_Bucket] = _Dummy_head;
1260  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
static size_type _Segment_size(size_type _K)
Definition: internal_concurrent_hash.h:196
_FwdIt _Uninitialized_default_fill_n(_FwdIt _First, _Diff _Count, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:258
static size_type _Segment_base(size_type _K)
Definition: internal_concurrent_hash.h:191
static size_type __cdecl _Segment_index_of(size_type _Index)
Definition: internal_concurrent_hash.h:186
void * _InterlockedCompareExchangePointer(void *volatile *, void *, void *)
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
#define NULL
Definition: corecrt.h:158
template<typename _Traits>
_Split_order_key Concurrency::details::_Concurrent_hash< _Traits >::_Split_order_dummy_key ( _Map_key  _Order_key) const
inlineprivate
1301  {
1302  return _Reverse(_Order_key) & ~(0x1);
1303  }
_Split_order_key _Reverse(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1277
template<typename _Traits>
_Split_order_key Concurrency::details::_Concurrent_hash< _Traits >::_Split_order_regular_key ( _Map_key  _Order_key) const
inlineprivate
1295  {
1296  return _Reverse(_Order_key) | 0x1;
1297  }
_Split_order_key _Reverse(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1277
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Swap_buckets ( _Concurrent_hash< _Traits > &  _Right)
inlineprivate
967  {
968  if (_M_allocator == _Right._M_allocator)
969  {
970  // Swap all node segments
972  {
973  _Full_iterator * _Iterator_pointer = _M_buckets[_Index];
974  _M_buckets[_Index] = _Right._M_buckets[_Index];
975  _Right._M_buckets[_Index] = _Iterator_pointer;
976  }
977  }
978  else
979  {
980  throw std::invalid_argument("swap is invalid on non-equal allocators");
981  }
982  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
_In_ size_t _In_ int _Index
Definition: time.h:102
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::begin ( )
inline

Returns an iterator pointing to the first element in the concurrent container. This method is concurrency safe.

Returns
An iterator to the first element in the concurrent container.
268  {
269  return _M_split_ordered_list.begin();
270  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
iterator begin()
Definition: internal_split_ordered_list.h:437
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::begin ( ) const
inline

Returns an iterator pointing to the first element in the concurrent container. This method is concurrency safe.

Returns
An iterator to the first element in the concurrent container.
280  {
281  return _M_split_ordered_list.begin();
282  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
iterator begin()
Definition: internal_split_ordered_list.h:437
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::cbegin ( ) const
inline

Returns a const iterator pointing to the first element in the concurrent container. This method is concurrency safe.

Returns
A const iterator to the first element in the concurrent container.
318  {
319  return _M_split_ordered_list.cbegin();
320  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
const_iterator cbegin() const
Definition: internal_split_ordered_list.h:460
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::cend ( ) const
inline

Returns a const iterator pointing to the location succeeding the last element in the concurrent container. This method is concurrency safe.

Returns
A const iterator to the location succeeding the last element in the concurrent container.
330  {
331  return _M_split_ordered_list.cend();
332  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
const_iterator cend() const
Definition: internal_split_ordered_list.h:465
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::clear ( )
inline

Erases all the elements in the concurrent container. This function is not concurrency safe.

441  {
442  // Clear list
444 
445  // Clear buckets
447  {
448  if (_M_buckets[_Index] != NULL)
449  {
450  size_type _Seg_size = _Segment_size(_Index);
451  for (size_type _Index2 = 0; _Index2 < _Seg_size; _Index2++)
452  {
453  _M_allocator.destroy(&_M_buckets[_Index][_Index2]);
454  }
455  _M_allocator.deallocate(_M_buckets[_Index], _Seg_size);
456  }
457  }
458 
459  // memset all the buckets to zero and initialize the dummy node 0
460  _Init();
461  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1308
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
void _Init()
Definition: internal_concurrent_hash.h:937
static size_type _Segment_size(size_type _K)
Definition: internal_concurrent_hash.h:196
_In_ size_t _In_ int _Index
Definition: time.h:102
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1306
void clear()
Definition: internal_split_ordered_list.h:412
#define NULL
Definition: corecrt.h:158
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::count ( const key_type _Keyval) const
inline

Counts the number of elements matching a specified key. This function is concurrency safe.

Parameters
_KeyvalThe key to search for.
Returns
The number of times number of times the key appears in the container.
506  {
507  size_type _Count = 0;
508  const_iterator _It = _Find(_Keyval);
509  for (;_It != end() && !this->_M_comparator(this->_Key_function(*_It), _Keyval); _It++)
510  {
511  _Count++;
512  }
513  return _Count;
514  }
_Mylist::const_iterator const_iterator
Definition: internal_concurrent_hash.h:109
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
_Diff _Count
Definition: algorithm:1941
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Find(const key_type &_Keyval)
Definition: internal_concurrent_hash.h:998
template<typename _Traits>
bool Concurrency::details::_Concurrent_hash< _Traits >::empty ( ) const
inline

Tests whether no elements are present. This method is concurrency safe.

In the presence of concurrent inserts, whether or not the concurrent container is empty may change immediately after calling this function, before the return value is even read.

Returns
true if the concurrent container is empty, false otherwise.
225  {
226  return _M_split_ordered_list.empty();
227  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
bool empty() const
Definition: internal_split_ordered_list.h:471
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::end ( )
inline

Returns an iterator pointing to the location succeeding the last element in the concurrent container. This method is concurrency safe.

Returns
An iterator to the location succeeding the last element in the concurrent container.
293  {
294  return _M_split_ordered_list.end();
295  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
iterator end()
Definition: internal_split_ordered_list.h:450
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::end ( ) const
inline

Returns a const_iterator pointing to the location succeeding the last element in the concurrent container. This method is concurrency safe.

Returns
A const_iterator to the location succeeding the last element in the concurrent container.
306  {
307  return _M_split_ordered_list.end();
308  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
iterator end()
Definition: internal_split_ordered_list.h:450
template<typename _Traits>
std::pair<iterator, iterator> Concurrency::details::_Concurrent_hash< _Traits >::equal_range ( const key_type _Keyval)
inline

Finds a range that matches a specified key. This function is concurrency safe.

Parameters
_KeyvalThe key value to search for.
Returns
A pair where the first element is an iterator to the beginning and the second element is an iterator to the end of the range.

It is possible for concurrent inserts to cause additional keys to be inserted after the begin iterator and before the end iterator.

532  {
533  return _Equal_range(_Keyval);
534  }
std::pair< iterator, iterator > _Equal_range(const key_type &_Keyval)
Definition: internal_concurrent_hash.h:1116
template<typename _Traits>
std::pair<const_iterator, const_iterator> Concurrency::details::_Concurrent_hash< _Traits >::equal_range ( const key_type _Keyval) const
inline

Finds a range that matches a specified key. This function is concurrency safe.

Parameters
_KeyvalThe key value to search for.
Returns
A pair where the first element is an iterator to the beginning and the second element is an iterator to the end of the range.

It is possible for concurrent inserts to cause additional keys to be inserted after the begin iterator and before the end iterator.

552  {
553  return _Equal_range(_Keyval);
554  }
std::pair< iterator, iterator > _Equal_range(const key_type &_Keyval)
Definition: internal_concurrent_hash.h:1116
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::find ( const key_type _Keyval)
inline

Finds an element that matches a specified key. This function is concurrency safe.

Parameters
_KeyvalThe key value to search for.
Returns
An iterator pointing to the location of the first element that matched the key provided, or the iterator end() if no such element exists.
475  {
476  return _Find(_Keyval);
477  }
iterator _Find(const key_type &_Keyval)
Definition: internal_concurrent_hash.h:998
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::find ( const key_type _Keyval) const
inline

Finds an element that matches a specified key. This function is concurrency safe.

Parameters
_KeyvalThe key value to search for.
Returns
An iterator pointing to the location of the first element that matched the key provided, or the iterator end() if no such element exists.
491  {
492  return _Find(_Keyval);
493  }
iterator _Find(const key_type &_Keyval)
Definition: internal_concurrent_hash.h:998
template<typename _Traits>
allocator_type Concurrency::details::_Concurrent_hash< _Traits >::get_allocator ( ) const
inline

Returns the stored allocator object for this concurrent container. This method is concurrency safe.

Returns
The stored allocator object for this concurrent container.
209  {
211  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
allocator_type get_allocator() const
Definition: internal_split_ordered_list.h:407
template<typename _Traits>
float Concurrency::details::_Concurrent_hash< _Traits >::load_factor ( ) const
inline

Computes and returns the current load factor of the container. The load factor is the number of elements in the container divided by the number of buckets.

Returns
The load factor for the container.
784  {
785  return (float) size() / (float) unsafe_bucket_count();
786  }
size_type unsafe_bucket_count() const
Returns the current number of buckets in this container.
Definition: internal_concurrent_hash.h:563
size_type size() const
Returns the number of elements in this concurrent container. This method is concurrency safe...
Definition: internal_concurrent_hash.h:240
template<typename _Traits>
float Concurrency::details::_Concurrent_hash< _Traits >::max_load_factor ( ) const
inline

Gets or sets the maximum load factor of the container. The maximum load factor is the largest number of elements than can be in any bucket before the container grows its internal table.

Returns
The first member function returns the stored maximum load factor. The second member function does not return a value but throws an out_of_range exception if the supplied load factor is invalid..
799  {
800  return _M_maximum_bucket_size;
801  }
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::max_load_factor ( float  _Newmax)
inline

Gets or sets the maximum load factor of the container. The maximum load factor is the largest number of elements than can be in any bucket before the container grows its internal table.

Returns
The first member function returns the stored maximum load factor. The second member function does not return a value but throws an out_of_range exception if the supplied load factor is invalid..
814  {
815  // The _Newmax != _Newmax is a check for NaN, because NaN is != to itself
816  if (_Newmax != _Newmax || _Newmax < 0)
817  {
818  throw std::out_of_range("invalid hash load factor");
819  }
820 
821  _M_maximum_bucket_size = _Newmax;
822  }
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::max_size ( ) const
inline

Returns the maximum size of the concurrent container, determined by the allocator. This method is concurrency safe.

This upper bound value may actually be higher than what the container can actually hold.

Returns
The maximum number of elements that can be inserted into this concurrent container.
256  {
258  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
size_type max_size() const
Definition: internal_split_ordered_list.h:483
template<typename _Traits>
_Concurrent_hash& Concurrency::details::_Concurrent_hash< _Traits >::operator= ( const _Concurrent_hash< _Traits > &  _Right)
inline
149  {
150  if (this != &_Right)
151  {
152  _Copy(_Right);
153  }
154 
155  return (*this);
156  }
void _Copy(const _Mytype &_Right)
Definition: internal_concurrent_hash.h:947
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
_Concurrent_hash& Concurrency::details::_Concurrent_hash< _Traits >::operator= ( _Concurrent_hash< _Traits > &&  _Right)
inline
159  {
160  if (this != &_Right)
161  {
162  clear();
163  swap(_Right);
164  }
165 
166  return (*this);
167  }
void swap(_Concurrent_hash &_Right)
Swaps the contents of two concurrent containers. This function is not concurrency safe...
Definition: internal_concurrent_hash.h:424
void clear()
Erases all the elements in the concurrent container. This function is not concurrency safe...
Definition: internal_concurrent_hash.h:440
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::rehash ( size_type  _Buckets)
inline

Rebuilds the hash table.

Parameters
_BucketsThe desired number of buckets.

The member function alters the number of buckets to be at least _Buckets and rebuilds the hash table as needed. The number of buckets must be a power of 2. If not a power of 2, it will be rounded up to the next largest power of 2.

It throws an out_of_range exception if the number of buckets is invalid (either 0 or greater than the maximum number of buckets).

843  {
844  size_type _Current_buckets = _M_number_of_buckets;
845 
846  if (_Current_buckets > _Buckets)
847  {
848  return;
849  }
850  else if (_Buckets <= 0 || _Buckets > unsafe_max_bucket_count())
851  {
852  throw std::out_of_range("invalid number of buckets");
853  }
854  // Round up the number of buckets to the next largest power of 2
855  _M_number_of_buckets = ((size_type) 1) << _Get_msb(_Buckets*2-1);
856  }
size_type unsafe_max_bucket_count() const
Returns the maximum number of buckets in this container.
Definition: internal_concurrent_hash.h:575
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
unsigned char _Get_msb(size_t _Mask)
Definition: internal_concurrent_hash.h:71
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::size ( ) const
inline

Returns the number of elements in this concurrent container. This method is concurrency safe.

In the presence of concurrent inserts, the number of elements in the concurrent container may change immediately after calling this function, before the return value is even read.

Returns
The number of items in the container.
241  {
242  return _M_split_ordered_list.size();
243  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
size_type size() const
Definition: internal_split_ordered_list.h:477
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::swap ( _Concurrent_hash< _Traits > &  _Right)
inline

Swaps the contents of two concurrent containers. This function is not concurrency safe.

Parameters
_RightThe container to swap elements from.

The member function throws an invalid_argument exception if the swap is being performed on unequal allocators.

425  {
426  if (this != &_Right)
427  {
428  std::_Swap_adl(this->_M_comparator, _Right._M_comparator);
429  _M_split_ordered_list.swap(_Right._M_split_ordered_list);
431  std::swap(_M_number_of_buckets, _Right._M_number_of_buckets);
432  std::swap(_M_maximum_bucket_size, _Right._M_maximum_bucket_size);
433  }
434  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1310
void _Swap_buckets(_Concurrent_hash &_Right)
Definition: internal_concurrent_hash.h:966
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
void swap(_Mytype &_Right)
Definition: internal_split_ordered_list.h:489
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:73
void swap(any &_Left, any &_Right) _NOEXCEPT
Definition: any:450
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<typename _Traits>
local_iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_begin ( size_type  _Bucket)
inline

Returns an iterator to the first element in this container for a specific bucket.

Parameters
_BucketThe bucket index.
Returns
An iterator pointing to the beginning of the bucket.
638  {
639  // It is possible the bucket being searched for has not yet been initialized
640  if (!_Is_initialized(_Bucket))
641  {
642  _Initialize_bucket(_Bucket);
643  }
644 
645  _Full_iterator _Iterator = _Get_bucket(_Bucket);
647  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:571
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
const_local_iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_begin ( size_type  _Bucket) const
inline

Returns an iterator to the first element in this container for a specific bucket.

Parameters
_BucketThe bucket index.
Returns
An iterator pointing to the beginning of the bucket.
660  {
661  // It is possible the bucket being searched for has not yet been initialized
662  if (!_Is_initialized(_Bucket))
663  {
664  const_cast<_Concurrent_hash*>(this)->_Initialize_bucket(_Bucket);
665  }
666 
667  _Full_const_iterator _Iterator = _Get_bucket(_Bucket);
669  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
_Mylist::_Full_const_iterator _Full_const_iterator
Definition: internal_concurrent_hash.h:117
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Concurrent_hash(size_type _Number_of_buckets=_Initial_bucket_number, const _Key_compare &_Parg=_Key_compare(), const allocator_type &_Allocator=allocator_type())
Definition: internal_concurrent_hash.h:124
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:571
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::unsafe_bucket ( const key_type _Keyval) const
inline

Returns the bucket index that a specific key maps to in this container.

Parameters
_KeyvalThe element key being searched for.
Returns
The bucket index for the key in this container.
621  {
622  _Split_order_key _Order_key = (_Split_order_key) this->_M_comparator(_Keyval);
623  size_type _Bucket = _Order_key % _M_number_of_buckets;
624  return _Bucket;
625  }
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::unsafe_bucket_count ( ) const
inline

Returns the current number of buckets in this container.

Returns
The current number of buckets in this container.
564  {
565  return _M_number_of_buckets;
566  }
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::unsafe_bucket_size ( size_type  _Bucket)
inline

Returns the number of items in a specific bucket of this container.

Parameters
_BucketThe bucket to search for.
Returns
The current number of buckets in this container.
591  {
592  size_type _Count = 0;
593 
594  if (!_Is_initialized(_Bucket))
595  {
596  return _Count;
597  }
598 
599  _Full_iterator _Iterator = _Get_bucket(_Bucket);
600  _Iterator++;
601 
602  for (; _Iterator != _M_split_ordered_list._End() && !_Iterator._Mynode()->_Is_dummy(); _Iterator++)
603  {
604  _Count++;
605  }
606 
607  return _Count;
608  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
_Diff _Count
Definition: algorithm:1941
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
const_local_iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_cbegin ( size_type  ) const
inline

Returns an iterator to the first element in this container for a specific bucket.

Parameters
_BucketThe bucket index.
Returns
An iterator pointing to the beginning of the bucket.
756  {
757  return ((const _Mytype *) this)->begin();
758  }
_Concurrent_hash< _Traits > _Mytype
Definition: internal_concurrent_hash.h:92
template<typename _Traits>
const_local_iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_cend ( size_type  ) const
inline

Returns an iterator to the first element in this container for a specific bucket.

Parameters
_BucketThe bucket index.
Returns
An iterator pointing to the beginning of the bucket.
771  {
772  return ((const _Mytype *) this)->end();
773  }
_Concurrent_hash< _Traits > _Mytype
Definition: internal_concurrent_hash.h:92
template<typename _Traits>
local_iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_end ( size_type  _Bucket)
inline

Returns an iterator to the last element in this container for a specific bucket.

Parameters
_BucketThe bucket index.
Returns
An iterator pointing to the end of the bucket.
682  {
683  // If we've increased the number of buckets, there's a chance the intermediate dummy
684  // node marking the end of this bucket has not yet been lazily initialized.
685  // Inserting from _M_number_of_buckets/2 to _M_number_of_buckets will recursively
686  // initialize all the dummy nodes in the map.
687  for(size_type _Bucket_index = _M_number_of_buckets >> 1; _Bucket_index < _M_number_of_buckets; _Bucket_index++)
688  {
689  if (!_Is_initialized(_Bucket_index))
690  {
691  _Initialize_bucket(_Bucket_index);
692  }
693  }
694 
695  _Full_iterator _Iterator = _Get_bucket(_Bucket);
696 
697  // Find the end of the bucket, denoted by the dummy element
698  do
699  {
700  _Iterator++;
701  }
702  while(_Iterator != _M_split_ordered_list._End() && !_Iterator._Mynode()->_Is_dummy());
703 
704  // Return the first real element past the end of the bucket
706  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:571
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
const_local_iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_end ( size_type  _Bucket) const
inline

Returns an iterator to the last element in this container for a specific bucket.

Parameters
_BucketThe bucket index.
Returns
An iterator pointing to the end of the bucket.
719  {
720  // If we've increased the number of buckets, there's a chance the intermediate dummy
721  // node marking the end of this bucket has not yet been lazily initialized.
722  // Inserting from _M_number_of_buckets/2 to _M_number_of_buckets will recursively
723  // initialize all the dummy nodes in the map.
724  for(size_type _Bucket_index = _M_number_of_buckets >> 1; _Bucket_index < _M_number_of_buckets; _Bucket_index++)
725  {
726  if (!_Is_initialized(_Bucket_index))
727  {
728  const_cast<_Concurrent_hash*>(this)->_Initialize_bucket(_Bucket_index);
729  }
730  }
731 
732  _Full_const_iterator _Iterator = _Get_bucket(_Bucket);
733 
734  // Find the end of the bucket, denoted by the dummy element
735  do
736  {
737  _Iterator++;
738  }
739  while(_Iterator != _M_split_ordered_list._End() && !_Iterator._Mynode()->_Is_dummy());
740 
741  // Return the first real element past the end of the bucket
743  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
_Mylist::_Full_const_iterator _Full_const_iterator
Definition: internal_concurrent_hash.h:117
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1262
_Concurrent_hash(size_type _Number_of_buckets=_Initial_bucket_number, const _Key_compare &_Parg=_Key_compare(), const allocator_type &_Allocator=allocator_type())
Definition: internal_concurrent_hash.h:124
_Full_iterator _End()
Definition: internal_split_ordered_list.h:526
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1236
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:571
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1309
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1194
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_erase ( const_iterator  _Where)
inline

Removes elements from the container at specified positions. This method is not concurrency-safe.

Parameters
_WhereThe iterator position to erase from.

The first member function removes the element of the controlled sequence pointed to by _Where . The second member function removes the elements in the range [_First , _Last ).

The third member function removes the elements in the range delimited by equal_range(_Keyval )

.

Returns
The first two member functions return an iterator that designates the first element remaining beyond any elements removed, or end() if no such element exists. The third member function returns the number of elements it removes.
351  {
352  if (_Where == end())
353  {
354  return end();
355  }
356 
357  return _Erase(_Where);
358  }
iterator _Erase(const_iterator _Iterator)
Definition: internal_concurrent_hash.h:1075
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::unsafe_erase ( const_iterator  _First,
const_iterator  _Last 
)
inline

Removes elements from the container at specified positions. This method is not concurrency-safe.

Parameters
_FirstThe position of the first element in the range of elements to be erased.
_LastThe position of the first element beyond the range of elements to be erased.

The first member function removes the element of the controlled sequence pointed to by _Where . The second member function removes the elements in the range [_First , _Last ).

The third member function removes the elements in the range delimited by equal_range(_Keyval )

.

Returns
The first two member functions return an iterator that designates the first element remaining beyond any elements removed, or end() if no such element exists. The third member function returns the number of elements it removes.
380  {
381  while (_First != _Last)
382  {
383  unsafe_erase(_First++);
384  }
385 
386  return _M_split_ordered_list._Get_iterator(_First);
387  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1307
iterator unsafe_erase(const_iterator _Where)
Removes elements from the container at specified positions. This method is not concurrency-safe.
Definition: internal_concurrent_hash.h:350
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:543
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::unsafe_erase ( const key_type _Keyval)
inline

Removes elements from the container at specified positions. This method is not concurrency-safe.

Parameters
_KeyvalThe key value to erase.

The first member function removes the element of the controlled sequence pointed to by _Where . The second member function removes the elements in the range [_First , _Last ).

The third member function removes the elements in the range delimited by equal_range(_Keyval )

.

Returns
The first two member functions return an iterator that designates the first element remaining beyond any elements removed, or end() if no such element exists. The third member function returns the number of elements it removes.
406  {
407  std::pair<iterator, iterator> _Where = equal_range(_Keyval);
408  size_type _Count = _Distance(_Where.first, _Where.second);
409  unsafe_erase(_Where.first, _Where.second);
410  return _Count;
411  }
iterator unsafe_erase(const_iterator _Where)
Removes elements from the container at specified positions. This method is not concurrency-safe.
Definition: internal_concurrent_hash.h:350
std::pair< iterator, iterator > equal_range(const key_type &_Keyval)
Finds a range that matches a specified key. This function is concurrency safe.
Definition: internal_concurrent_hash.h:531
size_type _Distance(const_iterator _First, const_iterator _Last) const
Definition: internal_concurrent_hash.h:985
_Diff _Count
Definition: algorithm:1941
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::unsafe_max_bucket_count ( ) const
inline

Returns the maximum number of buckets in this container.

Returns
The maximum number of buckets in this container.
576  {
578  }
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
static size_type _Segment_size(size_type _K)
Definition: internal_concurrent_hash.h:196

Member Data Documentation

template<typename _Traits>
const size_type Concurrency::details::_Concurrent_hash< _Traits >::_Initial_bucket_load = 4
static
template<typename _Traits>
const size_type Concurrency::details::_Concurrent_hash< _Traits >::_Initial_bucket_number = 8
static
template<typename _Traits>
allocator_type::template rebind<_Full_iterator>::other Concurrency::details::_Concurrent_hash< _Traits >::_M_allocator
private
template<typename _Traits>
_Full_iterator* Concurrency::details::_Concurrent_hash< _Traits >::_M_buckets[_Pointers_per_table]
private
template<typename _Traits>
float Concurrency::details::_Concurrent_hash< _Traits >::_M_maximum_bucket_size
private
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::_M_number_of_buckets
private
template<typename _Traits>
_Mylist Concurrency::details::_Concurrent_hash< _Traits >::_M_split_ordered_list
private
template<typename _Traits>
size_type const Concurrency::details::_Concurrent_hash< _Traits >::_Pointers_per_table = sizeof(size_type) * 8
static

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