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::tr1::conditional< std::tr1::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::tr1::conditional<std::tr1::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:1309
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
static const size_type _Initial_bucket_load
Definition: internal_concurrent_hash.h:120
void _Init()
Definition: internal_concurrent_hash.h:938
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
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:1309
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
void _Copy(const _Mytype &_Right)
Definition: internal_concurrent_hash.h:948
const _Ty & _Right
Definition: algorithm:4087
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:1309
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
void _Copy(const _Mytype &_Right)
Definition: internal_concurrent_hash.h:948
void _Init()
Definition: internal_concurrent_hash.h:938
const _Ty & _Right
Definition: algorithm:4087
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:1309
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
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:938
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
const _Ty & _Right
Definition: algorithm:4087
template<typename _Traits>
Concurrency::details::_Concurrent_hash< _Traits >::~_Concurrent_hash ( )
inline
170  {
171  // Delete all node segments
172  for (size_type _Index = 0; _Index < _Pointers_per_table; _Index++)
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:1309
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
#define NULL
Definition: crtdbg.h:30
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1307

Member Function Documentation

template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Adjust_table_size ( size_type  _Total_elements,
size_type  _Current_size 
)
inlineprivate
1220  {
1221  // Grow the table by a factor of 2 if possible and needed
1222  if (((float) _Total_elements / (float) _Current_size) > _M_maximum_bucket_size)
1223  {
1224  // Double the size of the hash only if size has not changed inbetween loads
1225  _InterlockedCompareExchangeSizeT(&_M_number_of_buckets, 2 * _Current_size, _Current_size);
1226  }
1227  }
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
#define _InterlockedCompareExchangeSizeT(_Target, _Exchange, _Comparand)
Definition: concrt.h:112
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Copy ( const _Mytype _Right)
inlineprivate
949  {
950  clear();
951 
952  _M_maximum_bucket_size = _Right._M_maximum_bucket_size;
953  _M_number_of_buckets = _Right._M_number_of_buckets;
954 
955  try
956  {
957  _Insert(_Right.begin(), _Right.end());
958  _M_comparator = _Right._M_comparator;
959  }
960  catch(...)
961  {
963  throw;
964  }
965  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
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:862
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
void clear()
Definition: internal_split_ordered_list.h:406
const _Ty & _Right
Definition: algorithm:4087
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::_Distance ( const_iterator  _First,
const_iterator  _Last 
) const
inlineprivate
987  {
988  size_type _Num = 0;
989 
990  for (const_iterator _Iterator = _First; _Iterator != _Last; _Iterator++)
991  {
992  _Num++;
993  }
994 
995  return _Num;
996  }
_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
1118  {
1119  _Split_order_key _Order_key = (_Split_order_key) _M_comparator(_Keyval);
1120  size_type _Bucket = _Order_key % _M_number_of_buckets;
1121 
1122  // If _Bucket is empty, initialize it first
1123  if (!_Is_initialized(_Bucket))
1124  {
1125  _Initialize_bucket(_Bucket);
1126  }
1127 
1128  _Order_key = _Split_order_regular_key(_Order_key);
1130 
1131  for (_Full_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1132  {
1133  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1134  {
1135  // There is no element with the given key
1136  return std::pair<iterator, iterator>(end(), end());
1137  }
1138  else if (_Mylist::_Get_key(_Iterator) == _Order_key && !_M_comparator(_Key_function(*_Iterator), _Keyval))
1139  {
1140  iterator _Begin = _M_split_ordered_list._Get_iterator(_Iterator);
1141  iterator _End= _Begin;
1142 
1143  for (;_End != end() && !_M_comparator(_Key_function(*_End), _Keyval); _End++)
1144  {
1145  }
1146 
1147  return std::pair<iterator, iterator>(_Begin, _End);
1148  }
1149  }
1150 
1151  return std::pair<iterator, iterator>(end(), end());
1152  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1295
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:530
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
Definition: xutility:337
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
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:1310
_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:537
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
template<typename _Traits>
std::pair<const_iterator, const_iterator> Concurrency::details::_Concurrent_hash< _Traits >::_Equal_range ( const key_type _Keyval) const
inlineprivate
1157  {
1158  _Split_order_key _Order_key = (_Split_order_key) _M_comparator(_Keyval);
1159  size_type _Bucket = _Order_key % _M_number_of_buckets;
1160 
1161  // If _Bucket has not been initialized, keep searching up for a parent bucket
1162  // that has been initialized. Worst case is the entire map will be read.
1163  while (!_Is_initialized(_Bucket))
1164  {
1165  _Bucket = _Get_parent(_Bucket);
1166  }
1167 
1168  _Order_key = _Split_order_regular_key(_Order_key);
1170 
1171  for (_Full_const_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1172  {
1173  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1174  {
1175  // There is no element with the given key
1176  return std::pair<const_iterator, const_iterator>(end(), end());
1177  }
1178  else if (_Mylist::_Get_key(_Iterator) == _Order_key && !_M_comparator(_Key_function(*_Iterator), _Keyval))
1179  {
1181  const_iterator _End = _Begin;
1182 
1183  for (; _End != end() && !_M_comparator(_Key_function(*_End), _Keyval); _End++)
1184  {
1185  }
1186 
1187  return std::pair<const_iterator, const_iterator>(_Begin, _End);
1188  }
1189  }
1190 
1191  return std::pair<const_iterator, const_iterator>(end(), end());
1192  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1295
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_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:530
_Mylist::const_iterator const_iterator
Definition: internal_concurrent_hash.h:109
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
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:1310
_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:1229
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:537
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::_Erase ( const_iterator  _Iterator)
inlineprivate
1077  {
1078  _Split_order_key _Order_key = (_Split_order_key) _M_comparator(_Key_function(*_Iterator));
1079  size_type _Bucket = _Order_key % _M_number_of_buckets;
1080 
1081  // If bucket is empty, initialize it first
1082  if (!_Is_initialized(_Bucket))
1083  {
1084  _Initialize_bucket(_Bucket);
1085  }
1086 
1087  _Order_key = _Split_order_regular_key(_Order_key);
1088 
1089  _Full_iterator _Previous = _Get_bucket(_Bucket);
1091  _Full_iterator _Where = _Previous;
1092 
1093  _ASSERT_EXPR(_Where != _Last, L"Invalid head node");
1094 
1095  // First node is a dummy node
1096  _Where++;
1097 
1098  for (;;)
1099  {
1100  if (_Where == _Last)
1101  {
1102  return end();
1103  }
1104  else if (_M_split_ordered_list._Get_iterator(_Where) == _Iterator)
1105  {
1106  return _M_split_ordered_list._Erase(_Previous, _Iterator);
1107  }
1108 
1109  // Move the iterator forward
1110  _Previous = _Where;
1111  _Where++;
1112  }
1113  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1295
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
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:590
#define _ASSERT_EXPR(expr, expr_str)
Definition: crtdbg.h:220
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
_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:537
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
template<typename _Traits>
iterator Concurrency::details::_Concurrent_hash< _Traits >::_Find ( const key_type _Keyval)
inlineprivate
1000  {
1001  _Split_order_key _Order_key = (_Split_order_key) _M_comparator(_Keyval);
1002  size_type _Bucket = _Order_key % _M_number_of_buckets;
1003 
1004  // If _Bucket is empty, initialize it first
1005  if (!_Is_initialized(_Bucket))
1006  {
1007  _Initialize_bucket(_Bucket);
1008  }
1009 
1010  _Order_key = _Split_order_regular_key(_Order_key);
1012 
1013  for (_Full_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1014  {
1015  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1016  {
1017  // If the order key is smaller than the current order key, the element
1018  // is not in the hash.
1019  return end();
1020  }
1021  else if (_Mylist::_Get_key(_Iterator) == _Order_key)
1022  {
1023  // The fact that order keys match does not mean that the element is found.
1024  // Key function comparison has to be performed to check whether this is the
1025  // right element. If not, keep searching while order key is the same.
1026  if (!_M_comparator(_Key_function(*_Iterator), _Keyval))
1027  {
1028  return _M_split_ordered_list._Get_iterator(_Iterator);
1029  }
1030  }
1031  }
1032 
1033  return end();
1034  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1295
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:530
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
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:1310
_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:537
_FwdIt _Last
Definition: algorithm:1936
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
template<typename _Traits>
const_iterator Concurrency::details::_Concurrent_hash< _Traits >::_Find ( const key_type _Keyval) const
inlineprivate
1038  {
1039  _Split_order_key _Order_key = (_Split_order_key) _M_comparator(_Keyval);
1040  size_type _Bucket = _Order_key % _M_number_of_buckets;
1041 
1042  // If _Bucket has not been initialized, keep searching up for a parent bucket
1043  // that has been initialized. Worst case is the entire map will be read.
1044  while (!_Is_initialized(_Bucket))
1045  {
1046  _Bucket = _Get_parent(_Bucket);
1047  }
1048 
1049  _Order_key = _Split_order_regular_key(_Order_key);
1051 
1052  for (_Full_const_iterator _Iterator = _Get_bucket(_Bucket); _Iterator != _Last; _Iterator++)
1053  {
1054  if (_Mylist::_Get_key(_Iterator) > _Order_key)
1055  {
1056  // If the order key is smaller than the current order key, the element
1057  // is not in the hash.
1058  return end();
1059  }
1060  else if (_Mylist::_Get_key(_Iterator) == _Order_key)
1061  {
1062  // The fact that order keys match does not mean that the element is found.
1063  // Key function comparison has to be performed to check whether this is the
1064  // right element. If not, keep searching while order key is the same.
1065  if (!_M_comparator(_Key_function(*_Iterator), _Keyval))
1066  {
1067  return _M_split_ordered_list._Get_iterator(_Iterator);
1068  }
1069  }
1070  }
1071 
1072  return end();
1073  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1295
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_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:530
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
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:1310
_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:1229
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:537
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
_Full_iterator Concurrency::details::_Concurrent_hash< _Traits >::_Get_bucket ( size_type  _Bucket) const
inlineprivate
1238  {
1239  size_type _Segment = _Segment_index_of(_Bucket);
1240  _Bucket -= _Segment_base(_Segment);
1241  return _M_buckets[_Segment][_Bucket];
1242  }
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:1307
template<typename _Traits>
size_type Concurrency::details::_Concurrent_hash< _Traits >::_Get_parent ( size_type  _Bucket) const
inlineprivate
1230  {
1231  // Unsets bucket's most significant turned-on bit
1232  unsigned char _Msb = _Get_msb(_Bucket);
1233  return _Bucket & ~(1 << _Msb);
1234  }
unsigned char _Get_msb(size_t _Mask)
Definition: internal_concurrent_hash.h:71
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Init ( )
inlineprivate
939  {
940  // Allocate an array of segment pointers
941  memset(_M_buckets, 0, _Pointers_per_table * sizeof(void *));
942 
943  // Insert the first element in the split-ordered list
945  _Set_bucket(0, _Dummy_node);
946  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_Full_iterator _Begin()
Definition: internal_split_ordered_list.h:509
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:1244
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1307
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Initialize_bucket ( size_type  _Bucket)
inlineprivate
1196  {
1197  // Bucket 0 has no parent. Initialize it and return.
1198  if (_Bucket == 0)
1199  {
1200  _Init();
1201  return;
1202  }
1203 
1204  size_type _Parent_bucket = _Get_parent(_Bucket);
1205 
1206  // All _Parent_bucket buckets have to be initialized before this bucket is
1207  if (!_Is_initialized(_Parent_bucket))
1208  {
1209  _Initialize_bucket(_Parent_bucket);
1210  }
1211 
1212  _Full_iterator _Parent = _Get_bucket(_Parent_bucket);
1213 
1214  // Create a dummy first node in this bucket
1216  _Set_bucket(_Bucket, _Dummy_node);
1217  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_Full_iterator _Insert_dummy(_Full_iterator _Iterator, _Split_order_key _Order_key)
Definition: internal_split_ordered_list.h:627
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
void _Init()
Definition: internal_concurrent_hash.h:938
_Split_order_key _Split_order_dummy_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1301
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
void _Set_bucket(size_type _Bucket, _Full_iterator _Dummy_head)
Definition: internal_concurrent_hash.h:1244
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _Get_parent(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1229
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
template<typename _Traits>
template<typename _ValTy >
std::pair<iterator, bool> Concurrency::details::_Concurrent_hash< _Traits >::_Insert ( _ValTy &&  _Value)
inlineprotected
863  {
864  _Split_order_key _Order_key = (_Split_order_key) _M_comparator(_Key_function(_Value));
865  size_type _Bucket = _Order_key % _M_number_of_buckets;
866 
867  // If bucket is empty, initialize it first
868  if (!_Is_initialized(_Bucket))
869  {
870  _Initialize_bucket(_Bucket);
871  }
872 
873  long _New_count;
874  _Order_key = _Split_order_regular_key(_Order_key);
875  _Full_iterator _Iterator = _Get_bucket(_Bucket);
877  _Full_iterator _Where = _Iterator;
878  _Nodeptr _New_node = _M_split_ordered_list._Buynode(_Order_key, std::forward<_ValTy>(_Value));
879 
880  _ASSERT_EXPR(_Where != _Last, L"Invalid head node");
881 
882  // First node is a dummy node
883  _Where++;
884 
885  for (;;)
886  {
887  if (_Where == _Last || _Mylist::_Get_key(_Where) > _Order_key)
888  {
889  // Try to insert it in the right place
890  std::pair<iterator, bool> _Result = _M_split_ordered_list._Insert(_Iterator, _Where, _New_node, &_New_count);
891 
892  if (_Result.second)
893  {
894  // Insertion succeeded, adjust the table size, if needed
896  return _Result;
897  }
898  else
899  {
900  // Insertion failed: either the same node was inserted by another thread, or
901  // another element was inserted at exactly the same place as this node.
902  // Proceed with the search from the previous location where order key was
903  // known to be larger (note: this is legal only because there is no safe
904  // concurrent erase operation supported).
905  _Where = _Iterator;
906  _Where++;
907  continue;
908  }
909  }
910  else if (!_M_allow_multimapping && _Mylist::_Get_key(_Where) == _Order_key &&
911  _M_comparator(_Key_function(*_Where), _Key_function(_New_node->_M_element)) == 0)
912  {
913  // If the insert failed (element already there), then delete the new one
914  _M_split_ordered_list._Erase(_New_node);
915 
916  // Element already in the list, return it
917  return std::pair<iterator, bool>(_M_split_ordered_list._Get_iterator(_Where), false);
918  }
919 
920  // Move the iterator forward
921  _Iterator = _Where;
922  _Where++;
923  }
924  }
_Split_order_key _Split_order_regular_key(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1295
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
static _Split_order_key _Get_key(const _Full_const_iterator &_Iterator)
Definition: internal_split_ordered_list.h:530
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
void _Erase(_Nodeptr _Delete_node)
Definition: internal_split_ordered_list.h:590
#define _ASSERT_EXPR(expr, expr_str)
Definition: crtdbg.h:220
_Nodeptr _Insert(_Nodeptr _Previous, _Nodeptr _New_node, _Nodeptr _Current_node)
Definition: internal_split_ordered_list.h:602
_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:316
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
_Map_key _Split_order_key
Definition: internal_split_ordered_list.h:195
void _Adjust_table_size(size_type _Total_elements, size_type _Current_size)
Definition: internal_concurrent_hash.h:1219
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
iterator _Get_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:537
_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:1195
template<typename _Traits>
template<class _Iterator >
void Concurrency::details::_Concurrent_hash< _Traits >::_Insert ( _Iterator  _First,
_Iterator  _Last 
)
inlineprotected
928  {
929  for (_Iterator _I = _First; _I != _Last; _I++)
930  {
931  _Insert(*_I);
932  }
933  }
std::pair< iterator, bool > _Insert(_ValTy &&_Value)
Definition: internal_concurrent_hash.h:862
_FwdIt _Last
Definition: algorithm:1936
template<typename _Traits>
bool Concurrency::details::_Concurrent_hash< _Traits >::_Is_initialized ( size_type  _Bucket) const
inlineprivate
1264  {
1265  size_type _Segment = _Segment_index_of(_Bucket);
1266  _Bucket -= _Segment_base(_Segment);
1267 
1268  if (_M_buckets[_Segment] == NULL)
1269  {
1270  return false;
1271  }
1272 
1273  _Full_iterator _Iterator = _M_buckets[_Segment][_Bucket];
1274  return (_Iterator._Mynode() != NULL);
1275  }
#define NULL
Definition: crtdbg.h:30
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:1307
template<typename _Traits>
_Split_order_key Concurrency::details::_Concurrent_hash< _Traits >::_Reverse ( _Map_key  _Order_key) const
inlineprivate
1279  {
1280  _Split_order_key _Reversed_order_key;
1281 
1282  unsigned char * _Original = (unsigned char *) &_Order_key;
1283  unsigned char * _Reversed = (unsigned char *) &_Reversed_order_key;
1284 
1285  int _Size = sizeof(_Map_key);
1286  for (int _Index = 0; _Index < _Size; _Index++)
1287  {
1288  _Reversed[_Size - _Index - 1] = _Reverse_byte(_Original[_Index]);
1289  }
1290 
1291  return _Reversed_order_key;
1292  }
size_t _Map_key
Definition: internal_split_ordered_list.h:194
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
_Check_return_ _In_ long _Size
Definition: io.h:325
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  }
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
1245  {
1246  size_type _Segment = _Segment_index_of(_Bucket);
1247  _Bucket -= _Segment_base(_Segment);
1248 
1249  if (_M_buckets[_Segment] == NULL)
1250  {
1251  size_type _Seg_size = _Segment_size(_Segment);
1252  _Full_iterator * _New_segment = _M_allocator.allocate(_Seg_size);
1253  std::_Wrap_alloc<decltype(_M_allocator)> _Wrapped_allocator(_M_allocator);
1254  std::_Uninitialized_default_fill_n(_New_segment, _Seg_size, _Wrapped_allocator);
1255  if (_InterlockedCompareExchangePointer((void * volatile *) &_M_buckets[_Segment], _New_segment, NULL) != NULL)
1256  {
1257  _M_allocator.deallocate(_New_segment, _Seg_size);
1258  }
1259  }
1260  _M_buckets[_Segment][_Bucket] = _Dummy_head;
1261  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1309
static size_type _Segment_size(size_type _K)
Definition: internal_concurrent_hash.h:196
#define NULL
Definition: crtdbg.h:30
void _Uninitialized_default_fill_n(_FwdIt _First, _Diff _Count, _Alloc &_Al)
Definition: xmemory:688
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:1307
template<typename _Traits>
_Split_order_key Concurrency::details::_Concurrent_hash< _Traits >::_Split_order_dummy_key ( _Map_key  _Order_key) const
inlineprivate
1302  {
1303  return _Reverse(_Order_key) & ~(0x1);
1304  }
_Split_order_key _Reverse(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1278
template<typename _Traits>
_Split_order_key Concurrency::details::_Concurrent_hash< _Traits >::_Split_order_regular_key ( _Map_key  _Order_key) const
inlineprivate
1296  {
1297  return _Reverse(_Order_key) | 0x1;
1298  }
_Split_order_key _Reverse(_Map_key _Order_key) const
Definition: internal_concurrent_hash.h:1278
template<typename _Traits>
void Concurrency::details::_Concurrent_hash< _Traits >::_Swap_buckets ( _Concurrent_hash< _Traits > &  _Right)
inlineprivate
968  {
969  if (_M_allocator == _Right._M_allocator)
970  {
971  // Swap all node segments
972  for (size_type _Index = 0; _Index < _Pointers_per_table; _Index++)
973  {
974  _Full_iterator * _Iterator_pointer = _M_buckets[_Index];
975  _M_buckets[_Index] = _Right._M_buckets[_Index];
976  _Right._M_buckets[_Index] = _Iterator_pointer;
977  }
978  }
979  else
980  {
981  throw std::invalid_argument("swap is invalid on non-equal allocators");
982  }
983  }
allocator_type::template rebind< _Full_iterator >::other _M_allocator
Definition: internal_concurrent_hash.h:1309
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
_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:1307
const _Ty & _Right
Definition: algorithm:4087
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:1308
iterator begin()
Definition: internal_split_ordered_list.h:431
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:1308
iterator begin()
Definition: internal_split_ordered_list.h:431
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:1308
const_iterator cbegin() const
Definition: internal_split_ordered_list.h:454
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:1308
const_iterator cend() const
Definition: internal_split_ordered_list.h:459
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
446  for (size_type _Index = 0; _Index < _Pointers_per_table; _Index++)
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:1309
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
static size_type const _Pointers_per_table
Definition: internal_concurrent_hash.h:121
void _Init()
Definition: internal_concurrent_hash.h:938
static size_type _Segment_size(size_type _K)
Definition: internal_concurrent_hash.h:196
#define NULL
Definition: crtdbg.h:30
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
_Full_iterator * _M_buckets[_Pointers_per_table]
Definition: internal_concurrent_hash.h:1307
void clear()
Definition: internal_split_ordered_list.h:406
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() && !_M_comparator(_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:999
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:1308
bool empty() const
Definition: internal_split_ordered_list.h:465
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:1308
iterator end()
Definition: internal_split_ordered_list.h:444
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:1308
iterator end()
Definition: internal_split_ordered_list.h:444
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:1117
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:1117
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 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:999
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 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:999
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:1308
allocator_type get_allocator() const
Definition: internal_split_ordered_list.h:401
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.
785  {
786  return (float) size() / (float) unsafe_bucket_count();
787  }
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..
800  {
801  return _M_maximum_bucket_size;
802  }
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
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..
815  {
816  // The _Newmax != _Newmax is a check for NaN, because NaN is != to itself
817  if (_Newmax != _Newmax || _Newmax < 0)
818  {
819  throw std::out_of_range("invalid hash load factor");
820  }
821 
822  _M_maximum_bucket_size = _Newmax;
823  }
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
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:1308
size_type max_size() const
Definition: internal_split_ordered_list.h:477
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:948
const _Ty & _Right
Definition: algorithm:4087
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
const _Ty & _Right
Definition: algorithm:4087
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).

844  {
845  size_type _Current_buckets = _M_number_of_buckets;
846 
847  if (_Current_buckets > _Buckets)
848  {
849  return;
850  }
851  else if (_Buckets <= 0 || _Buckets > unsafe_max_bucket_count())
852  {
853  throw std::out_of_range("invalid number of buckets");
854  }
855  // Round up the number of buckets to the next largest power of 2
856  _M_number_of_buckets = ((size_type) 1) << _Get_msb(_Buckets*2-1);
857  }
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:1310
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:1308
size_type size() const
Definition: internal_split_ordered_list.h:471
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(_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:1308
float _M_maximum_bucket_size
Definition: internal_concurrent_hash.h:1311
void _Swap_buckets(_Concurrent_hash &_Right)
Definition: internal_concurrent_hash.h:967
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
void swap(_Mytype &_Right)
Definition: internal_split_ordered_list.h:483
void swap(array< _Ty, _Size > &_Left, array< _Ty, _Size > &_Right) _NOEXCEPT_OP(_NOEXCEPT_OP(_Left.swap(_Right)))
Definition: array:429
const _Ty & _Right
Definition: algorithm:4087
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:1308
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:565
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
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  _Initialize_bucket(_Bucket);
665  }
666 
667 
668  _Full_const_iterator _Iterator = _Get_bucket(_Bucket);
670  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_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:1263
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:565
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
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) _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:1310
_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:1310
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:1308
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
_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.
757  {
758  return ((const _Mytype *) this)->begin();
759  }
_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.
772  {
773  return ((const _Mytype *) this)->end();
774  }
_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.
683  {
684  // If we've increased the number of buckets, there's a chance the intermediate dummy
685  // node marking the end of this bucket has not yet been lazily initialized.
686  // Inserting from _M_number_of_buckets/2 to _M_number_of_buckets will recursively
687  // initialize all the dummy nodes in the map.
688  for(size_type _Bucket_index = _M_number_of_buckets >> 1; _Bucket_index < _M_number_of_buckets; _Bucket_index++)
689  {
690  if (!_Is_initialized(_Bucket_index))
691  {
692  _Initialize_bucket(_Bucket_index);
693  }
694  }
695 
696  _Full_iterator _Iterator = _Get_bucket(_Bucket);
697 
698  // Find the end of the bucket, denoted by the dummy element
699  do
700  {
701  _Iterator++;
702  }
703  while(_Iterator != _M_split_ordered_list._End() && !_Iterator._Mynode()->_Is_dummy());
704 
705  // Return the first real element past the end of the bucket
707  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
bool _Is_initialized(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:565
_Mylist::_Full_iterator _Full_iterator
Definition: internal_concurrent_hash.h:116
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
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.
720  {
721  // If we've increased the number of buckets, there's a chance the intermediate dummy
722  // node marking the end of this bucket has not yet been lazily initialized.
723  // Inserting from _M_number_of_buckets/2 to _M_number_of_buckets will recursively
724  // initialize all the dummy nodes in the map.
725  for(size_type _Bucket_index = _M_number_of_buckets >> 1; _Bucket_index < _M_number_of_buckets; _Bucket_index++)
726  {
727  if (!_Is_initialized(_Bucket_index))
728  {
729  _Initialize_bucket(_Bucket_index);
730  }
731  }
732 
733  _Full_const_iterator _Iterator = _Get_bucket(_Bucket);
734 
735  // Find the end of the bucket, denoted by the dummy element
736  do
737  {
738  _Iterator++;
739  }
740  while(_Iterator != _M_split_ordered_list._End() && !_Iterator._Mynode()->_Is_dummy());
741 
742  // Return the first real element past the end of the bucket
744  }
_Mylist _M_split_ordered_list
Definition: internal_concurrent_hash.h:1308
_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:1263
_Full_iterator _End()
Definition: internal_split_ordered_list.h:520
_Full_iterator _Get_bucket(size_type _Bucket) const
Definition: internal_concurrent_hash.h:1237
iterator _Get_first_real_iterator(_Full_iterator _Iterator)
Definition: internal_split_ordered_list.h:565
size_type _M_number_of_buckets
Definition: internal_concurrent_hash.h:1310
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
void _Initialize_bucket(size_type _Bucket)
Definition: internal_concurrent_hash.h:1195
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:1076
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:1308
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:537
_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:986
_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: