18 #define _PPL_CONTAINER
20 #if !(defined (_M_X64) || defined (_M_IX86) || defined (_M_ARM) || defined (_M_ARM64))
21 #error ERROR: Concurrency Runtime is supported only on X64, X86, ARM, and ARM64 architectures.
25 #error ERROR: Concurrency Runtime is not supported when compiling /clr.
28 #pragma pack(push,_CRT_PACKING)
30 #pragma warning(disable: 4100) // Unreferenced formal parameter - needed for document generation
37 template<
typename _Key_type,
typename _Element_type,
typename _Key_comparator,
typename _Allocator_type,
bool _Allow_multimapping>
41 typedef std::pair<const _Key_type, _Element_type>
value_type;
45 typedef typename _Allocator_type::template rebind<value_type>::other
allocator_type;
60 class _Value_compare :
public std::binary_function<value_type, value_type, bool>
78 template<
class _Type1,
class _Type2>
81 return (_Value.first);
116 template <
typename _Key_type,
typename _Element_type,
typename _Hasher = std::hash<_Key_type>,
typename _Key_equality = std::equal_to<_Key_type>,
typename _Allocator_type = std::allocator<std::pair<const _Key_type, _Element_type> > >
248 : _Mybase(_Number_of_buckets, _Key_compare(_Hasher, _Key_equality), _Allocator)
250 this->
rehash(_Number_of_buckets);
307 template <
typename _Iterator>
310 : _Mybase(_Number_of_buckets, _Key_compare(), allocator_type())
312 this->
rehash(_Number_of_buckets);
313 for (; _Begin != _End; ++_Begin)
478 return this->
_Insert(_Value).first;
506 template<
class _Iterator>
537 template<
class _Valty>
572 template<
class _Valty>
574 typename std::remove_reference<_Valty>::type>::value, iterator>::type
710 iterator _Where = this->
find(_Keyval);
712 if (_Where == this->
end())
717 return ((*_Where).second);
741 iterator _Where = this->
find(_Keyval);
743 if (_Where == this->
end())
748 return ((*_Where).second);
764 mapped_type&
at(
const key_type& _Keyval)
766 iterator _Where = this->
find(_Keyval);
768 if (_Where == this->
end())
770 throw std::out_of_range(
"invalid concurrent_unordered_map<K, T> key");
773 return ((*_Where).second);
789 const mapped_type&
at(
const key_type& _Keyval)
const
791 const_iterator _Where = this->
find(_Keyval);
793 if (_Where == this->
end())
795 throw std::out_of_range(
"invalid concurrent_unordered_map<K, T> key");
798 return ((*_Where).second);
831 template <
typename _Key_type,
typename _Element_type,
typename _Hasher = std::hash<_Key_type>,
typename _Key_equality = std::equal_to<_Key_type>,
typename _Allocator_type = std::allocator<std::pair<const _Key_type, _Element_type> > >
963 : _Mybase(_Number_of_buckets, _Key_compare(_Hasher, _Key_equality), _Allocator)
965 this->
rehash(_Number_of_buckets);
1022 template <
typename _Iterator>
1025 : _Mybase(_Number_of_buckets, _Key_compare(), allocator_type())
1027 this->
rehash(_Number_of_buckets);
1028 for (; _Begin != _End; ++_Begin)
1159 return this->
_Insert(_Value).first;
1188 return this->
_Insert(_Value).first;
1214 template<
class _Iterator>
1243 template<
class _Valty>
1275 template<
class _Valty>
1276 typename std::enable_if<!std::is_same<const_iterator, typename std::remove_reference<_Valty>::type>::value, iterator>::type
1395 #pragma warning(pop)
concurrent_unordered_multimap(const concurrent_unordered_multimap &_Umap, const allocator_type &_Allocator)
Constructs a concurrent unordered multimap.
Definition: concurrent_unordered_map.h:1073
_Mybase::const_iterator const_iterator
The type of a constant iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:922
concurrent_unordered_map(const allocator_type &_Allocator)
Constructs a concurrent unordered map.
Definition: concurrent_unordered_map.h:269
concurrent_unordered_multimap(const allocator_type &_Allocator)
Constructs a concurrent unordered multimap.
Definition: concurrent_unordered_map.h:984
details::_Hash_compare< _Key_type, _Hasher, _Key_equality > _Key_compare
Definition: concurrent_unordered_map.h:122
constexpr const _Ty &() _Left
Definition: algorithm:3590
hasher hash_function() const
Returns the stored hash function object.
Definition: concurrent_unordered_map.h:1374
concurrent_unordered_map & operator=(const concurrent_unordered_map &_Umap)
Assigns the contents of another concurrent_unordered_map object to this one. This method is not concu...
Definition: concurrent_unordered_map.h:396
_Mybase::difference_type difference_type
The type of a signed distance between two elements.
Definition: concurrent_unordered_map.h:910
static const _Type1 & _Key_function(const std::pair< _Type1, _Type2 > &_Value)
Definition: concurrent_unordered_map.h:79
concurrent_unordered_multimap(const concurrent_unordered_multimap &_Umap)
Constructs a concurrent unordered multimap.
Definition: concurrent_unordered_map.h:1050
_Mybase::pointer pointer
The type of a pointer to an element.
Definition: concurrent_unordered_map.h:165
void rehash(size_type _Buckets)
Rebuilds the hash table.
Definition: internal_concurrent_hash.h:842
_Mybase::difference_type difference_type
The type of a signed distance between two elements.
Definition: concurrent_unordered_map.h:195
iterator insert(const_iterator _Where, const value_type &_Value)
Adds elements to the concurrent_unordered_multimap object.
Definition: concurrent_unordered_map.h:1185
concurrent_unordered_multimap(size_type _Number_of_buckets=8, const hasher &_Hasher=hasher(), const key_equal &_Key_equality=key_equal(), const allocator_type &_Allocator=allocator_type())
Constructs a concurrent unordered multimap.
Definition: concurrent_unordered_map.h:961
void insert(_Iterator _First, _Iterator _Last)
Adds elements to the concurrent_unordered_map object.
Definition: concurrent_unordered_map.h:507
Definition: concurrent_unordered_map.h:38
concurrent_unordered_map(size_type _Number_of_buckets=8, const hasher &_Hasher=hasher(), const key_equal &_Key_equality=key_equal(), const allocator_type &_Allocator=allocator_type())
Constructs a concurrent unordered map.
Definition: concurrent_unordered_map.h:246
_Mybase::size_type size_type
The type of an unsigned distance between two elements.
Definition: concurrent_unordered_map.h:189
_Key_equality _M_key_compare_object
Definition: internal_concurrent_hash.h:55
Definition: internal_concurrent_hash.h:27
void insert(_Iterator _First, _Iterator _Last)
Adds elements to the concurrent_unordered_multimap object.
Definition: concurrent_unordered_map.h:1215
_Mybase::const_iterator const_local_iterator
The type of a constant bucket iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:934
void swap(_Concurrent_hash &_Right)
Swaps the contents of two concurrent containers. This function is not concurrency safe...
Definition: internal_concurrent_hash.h:424
_Mybase::reference reference
The type of a reference to an element.
Definition: concurrent_unordered_map.h:177
std::enable_if<!std::is_same< const_iterator, typename std::remove_reference< _Valty >::type >::value, iterator >::type insert(const_iterator _Where, _Valty &&_Value)
Adds elements to the concurrent_unordered_multimap object.
Definition: concurrent_unordered_map.h:1277
iterator unsafe_erase(const_iterator _First, const_iterator _Last)
Removes elements from the concurrent_unordered_multimap at specified positions. This method is not co...
Definition: concurrent_unordered_map.h:1350
_Key_equality key_equal
The type of the comparison function.
Definition: concurrent_unordered_map.h:868
hasher _M_hash_object
Definition: internal_concurrent_hash.h:54
const mapped_type & at(const key_type &_Keyval) const
Finds an element in a concurrent_unordered_map with a specified key value.. This method is concurrenc...
Definition: concurrent_unordered_map.h:789
The Concurrency namespace provides classes and functions that provide access to the Concurrency Runti...
Definition: agents.h:43
details::_Concurrent_hash< details::_Concurrent_unordered_map_traits< _Key_type, _Element_type, _Key_compare, _Allocator_type, true > > _Mybase
Definition: concurrent_unordered_map.h:838
_Mybase::const_iterator const_iterator
The type of a constant iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:207
allocator_type::const_pointer const_pointer
Definition: internal_concurrent_hash.h:101
iterator unsafe_erase(const_iterator _Begin, const_iterator _End)
Removes elements from the concurrent_unordered_map at specified positions. This method is not concurr...
Definition: concurrent_unordered_map.h:625
_Key_compare _M_comparator
Definition: concurrent_unordered_map.h:75
void swap(concurrent_unordered_map &_Umap)
Swaps the contents of two concurrent_unordered_map objects. This method is not concurrency-safe.
Definition: concurrent_unordered_map.h:660
_Mybase::pointer pointer
The type of a pointer to an element.
Definition: concurrent_unordered_map.h:880
Definition: internal_concurrent_hash.h:88
_Mybase::size_type size_type
The type of an unsigned distance between two elements.
Definition: concurrent_unordered_map.h:904
std::conditional< std::is_same< key_type, value_type >::value, typename _Mylist::const_iterator, typename _Mylist::iterator >::type iterator
Definition: internal_concurrent_hash.h:108
iterator end()
Returns an iterator pointing to the location succeeding the last element in the concurrent container...
Definition: internal_concurrent_hash.h:292
std::pair< iterator, bool > insert(_Valty &&_Value)
Adds elements to the concurrent_unordered_map object.
Definition: concurrent_unordered_map.h:538
hasher hash_function() const
Gets the stored hash function object.
Definition: concurrent_unordered_map.h:672
_Container_base0 _Container_base
Definition: xutility:246
mapped_type & at(const key_type &_Keyval)
Finds an element in a concurrent_unordered_map with a specified key value.. This method is concurrenc...
Definition: concurrent_unordered_map.h:764
std::pair< const _Key_type, _Element_type > value_type
Definition: concurrent_unordered_map.h:41
_Mybase::iterator local_iterator
The type of a bucket iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:928
_Concurrent_unordered_map_traits(const _Key_compare &_Traits)
Definition: concurrent_unordered_map.h:56
void swap(concurrent_unordered_multimap &_Umap)
Swaps the contents of two concurrent_unordered_multimap objects. This method is not concurrency-safe...
Definition: concurrent_unordered_map.h:1362
Definition: internal_split_ordered_list.h:30
concurrent_unordered_multimap & operator=(const concurrent_unordered_multimap &_Umap)
Assigns the contents of another concurrent_unordered_multimap object to this one. This method is not ...
Definition: concurrent_unordered_map.h:1111
iterator insert(const value_type &_Value)
Adds elements to the concurrent_unordered_multimap object.
Definition: concurrent_unordered_map.h:1157
_Allocator_type::template rebind< value_type >::other allocator_type
Definition: concurrent_unordered_map.h:45
_Mybase::iterator iterator
The type of an iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:201
concurrent_unordered_multimap(concurrent_unordered_multimap &&_Umap)
Constructs a concurrent unordered multimap.
Definition: concurrent_unordered_map.h:1093
iterator unsafe_erase(const_iterator _Where)
Removes elements from the concurrent_unordered_multimap at specified positions. This method is not co...
Definition: concurrent_unordered_map.h:1301
details::_Hash_compare< _Key_type, _Hasher, _Key_equality > _Key_compare
Definition: concurrent_unordered_map.h:837
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
constexpr pair< typename _Unrefwrap< _Ty1 >::type, typename _Unrefwrap< _Ty2 >::type > make_pair(_Ty1 &&_Val1, _Ty2 &&_Val2)
Definition: utility:323
_Mybase::const_iterator const_local_iterator
The type of a constant bucket iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:219
_Key_comparator _Key_compare
Definition: concurrent_unordered_map.h:43
_Traits::value_type value_type
Definition: internal_concurrent_hash.h:97
_Mybase::iterator iterator
The type of an iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:916
std::pair< iterator, bool > _Insert(_ValTy &&_Value)
Definition: internal_concurrent_hash.h:861
allocator_type::reference reference
Definition: internal_concurrent_hash.h:102
concurrent_unordered_map< _Key_type, _Element_type, _Hasher, _Key_equality, _Allocator_type > _Mytype
Definition: concurrent_unordered_map.h:121
concurrent_unordered_map(concurrent_unordered_map &&_Umap)
Constructs a concurrent unordered map.
Definition: concurrent_unordered_map.h:378
Definition: concurrent_unordered_map.h:49
size_type unsafe_erase(const key_type &_Keyval)
Removes elements from the concurrent_unordered_multimap at specified positions. This method is not co...
Definition: concurrent_unordered_map.h:1324
iterator insert(_Valty &&_Value)
Adds elements to the concurrent_unordered_multimap object.
Definition: concurrent_unordered_map.h:1244
iterator find(const key_type &_Keyval)
Finds an element that matches a specified key. This function is concurrency safe. ...
Definition: internal_concurrent_hash.h:474
allocator_type::pointer pointer
Definition: internal_concurrent_hash.h:100
_Key_type key_type
The type of an ordering key.
Definition: concurrent_unordered_map.h:129
_Mybase::value_type value_type
The type of an element.
Definition: concurrent_unordered_map.h:135
size_type unsafe_erase(const key_type &_Keyval)
Removes elements from the concurrent_unordered_map at specified positions. This method is not concurr...
Definition: concurrent_unordered_map.h:648
_Key_equality key_equal
The type of the comparison function.
Definition: concurrent_unordered_map.h:153
_Value_compare(const _Key_compare &_Traits)
Definition: concurrent_unordered_map.h:70
_Key_type key_type
Definition: concurrent_unordered_map.h:42
_Hasher hasher
The type of the hash function.
Definition: concurrent_unordered_map.h:147
_Mybase::const_pointer const_pointer
The type of a constant pointer to an element.
Definition: concurrent_unordered_map.h:886
_Mybase::const_pointer const_pointer
The type of a constant pointer to an element.
Definition: concurrent_unordered_map.h:171
concurrent_unordered_map(_Iterator _Begin, _Iterator _End, size_type _Number_of_buckets=8, const hasher &_Hasher=hasher(), const key_equal &_Key_equality=key_equal(), const allocator_type &_Allocator=allocator_type())
Constructs a concurrent unordered map.
Definition: concurrent_unordered_map.h:308
key_equal key_eq() const
Returns the stored equality comparison function object.
Definition: concurrent_unordered_map.h:1386
allocator_type::difference_type difference_type
Definition: internal_concurrent_hash.h:106
_Concurrent_unordered_map_traits()
Definition: concurrent_unordered_map.h:52
allocator_type::const_reference const_reference
Definition: internal_concurrent_hash.h:103
_Mybase::reference reference
The type of a reference to an element.
Definition: concurrent_unordered_map.h:892
mapped_type & operator[](const key_type &_Keyval)
Finds or inserts an element with the specified key. This method is concurrency-safe.
Definition: concurrent_unordered_map.h:708
_Element_type mapped_type
The type of a mapped value associated with each key.
Definition: concurrent_unordered_map.h:141
details::_Concurrent_hash< details::_Concurrent_unordered_map_traits< _Key_type, _Element_type, _Key_compare, _Allocator_type, false > > _Mybase
Definition: concurrent_unordered_map.h:123
The concurrent_unordered_multimap class is an concurrency-safe container that controls a varying-leng...
Definition: concurrent_unordered_map.h:832
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
_Element_type mapped_type
The type of a mapped value associated with each key.
Definition: concurrent_unordered_map.h:856
allocator_type::size_type size_type
Definition: internal_concurrent_hash.h:105
std::pair< iterator, bool > insert(const value_type &_Value)
Adds elements to the concurrent_unordered_map object.
Definition: concurrent_unordered_map.h:444
concurrent_unordered_multimap(_Iterator _Begin, _Iterator _End, size_type _Number_of_buckets=8, const hasher &_Hasher=hasher(), const key_equal &_Key_equality=key_equal(), const allocator_type &_Allocator=allocator_type())
Constructs a concurrent unordered multimap.
Definition: concurrent_unordered_map.h:1023
iterator unsafe_erase(const_iterator _Where)
Removes elements from the concurrent_unordered_map at specified positions. This method is not concurr...
Definition: concurrent_unordered_map.h:599
_Mybase::const_reference const_reference
The type of a constant reference to an element.
Definition: concurrent_unordered_map.h:183
_Key_compare _M_comparator
Definition: concurrent_unordered_map.h:83
_Mybase::const_reference const_reference
The type of a constant reference to an element.
Definition: concurrent_unordered_map.h:898
key_equal key_eq() const
Gets the stored equality comparison function object.
Definition: concurrent_unordered_map.h:684
_Mybase::value_type value_type
The type of an element.
Definition: concurrent_unordered_map.h:850
concurrent_unordered_multimap< _Key_type, _Element_type, _Hasher, _Key_equality, _Allocator_type > _Mytype
Definition: concurrent_unordered_map.h:836
concurrent_unordered_map(const concurrent_unordered_map &_Umap)
Constructs a concurrent unordered map.
Definition: concurrent_unordered_map.h:335
concurrent_unordered_multimap & operator=(concurrent_unordered_multimap &&_Umap)
Assigns the contents of another concurrent_unordered_multimap object to this one. This method is not ...
Definition: concurrent_unordered_map.h:1131
_Hasher hasher
The type of the hash function.
Definition: concurrent_unordered_map.h:862
_Key_type key_type
The type of an ordering key.
Definition: concurrent_unordered_map.h:844
_Mybase::allocator_type allocator_type
The type of an allocator for managing storage.
Definition: concurrent_unordered_map.h:159
_Concurrent_hash & operator=(const _Concurrent_hash &_Right)
Definition: internal_concurrent_hash.h:148
_In_ int _Value
Definition: setjmp.h:173
mapped_type & operator[](key_type &&_Keyval)
Finds or inserts an element with the specified key. This method is concurrency-safe.
Definition: concurrent_unordered_map.h:739
concurrent_unordered_map(const concurrent_unordered_map &_Umap, const allocator_type &_Allocator)
Constructs a concurrent unordered map.
Definition: concurrent_unordered_map.h:358
Definition: concurrent_unordered_map.h:60
iterator insert(const_iterator _Where, const value_type &_Value)
Adds elements to the concurrent_unordered_map object.
Definition: concurrent_unordered_map.h:475
_Traits::allocator_type allocator_type
Definition: internal_concurrent_hash.h:99
_FwdIt _Last
Definition: algorithm:1936
_Mybase::allocator_type allocator_type
The type of an allocator for managing storage.
Definition: concurrent_unordered_map.h:874
std::enable_if<!std::is_same< const_iterator, typename std::remove_reference< _Valty >::type >::value, iterator >::type insert(const_iterator _Where, _Valty &&_Value)
Adds elements to the concurrent_unordered_map object.
Definition: concurrent_unordered_map.h:575
_Mybase::iterator local_iterator
The type of a bucket iterator for the controlled sequence.
Definition: concurrent_unordered_map.h:213
constexpr const _Ty &() _Right
Definition: algorithm:3591
concurrent_unordered_map & operator=(concurrent_unordered_map &&_Umap)
Assigns the contents of another concurrent_unordered_map object to this one. This method is not concu...
Definition: concurrent_unordered_map.h:416
The concurrent_unordered_map class is a concurrency-safe container that controls a varying-length seq...
Definition: concurrent_unordered_map.h:117
bool operator()(const value_type &_Left, const value_type &_Right) const
Definition: concurrent_unordered_map.h:65