Concurrently safe modifiers¶
All member functions in this section can be performed concurrently with each other, lookup methods and while traversing the container.
Emplacing elements¶
template <typename... Args> std::pair<iterator, bool> emplace( Args&&... args );Attempts to insert an element ,constructed in-place from
argsinto the container.Returns:
std::pair<iterator, bool>whereiteratorpoints to the inserted element or to an existing element with equal key. Boolean value istrueif insertion took place,falseotherwise.Requirements: the type
value_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ Standard section.
template <typename... Args> iterator emplace_hint( const_iterator hint, Args&&... args );Attempts to insert an element ,constructed in-place from
argsinto the container.Optionally uses the parameter
hintas a suggestion to where the node should be placed.Returns: an
iteratorto the inserted element or to an existing element with equal key.Requirements: the type
value_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ Standard section.
Inserting values¶
std::pair<iterator, bool> insert( const value_type& value );Attempts to insert
valueinto the container.Returns:
std::pair<iterator, bool>whereiteratorpoints to the inserted element or to an existing element with equal key. Boolean value istrueif insertion took place,falseotherwise.Requirements: the type
value_typeshall meet theCopyInsertablerequirements from [container.requirements] ISO C++ Standard section.
iterator insert( const_iterator hint, const value_type& value );Attempts to insert
valueinto the container.Optionally uses the parameter
hintas a suggestion to where the element should be placed.Returns: an
iteratorto the inserted element or to an existing element with equal key.Requirements: the type
value_typeshall meet theCopyInsertablerequirements from [container.requirements] ISO C++ Standard section.
template <typename P> std::pair<iterator, bool> insert( P&& value );Equivalent to
emplace(std::forward<P>(value)).This overload only participates in overload resolution if
std::is_constructible<value_type, P&&>::valueistrue.
template <typename P> iterator insert( const_iterator hint, P&& value );Equivalent to
emplace_hint(hint, std::forward<P>(value)).This overload only participates in overload resolution if
std::is_constructible<value_type, P&&>::valueistrue.
std::pair<iterator, bool> insert( value_type&& value );Attempts to insert
valueinto the container using move semantics.
valueis left in a valid, but unspecified state.Returns:
std::pair<iterator, bool>whereiteratorpoints to the inserted element or to an existing element with equal key. Boolean value istrueif insertion took place,falseotherwise.Requirements: the type
value_typeshall meet theMoveInsertablerequirements from [container.requirements] ISO C++ Standard section.
iterator insert( const_iterator hint, value_type&& other );Attempts to insert
valueinto the container using move semantics.Optionally uses the parameter
hintas a suggestion to where the element should be placed.
valueis left in a valid, but unspecified state.Returns: an
iteratorto the inserted element or to an existing element with equal key.Requirements: the type
value_typeshall meet theMoveInsertablerequirements from [container.requirements] ISO C++ Standard section.
Inserting sequences of elements¶
template <typename InputIterator> void insert( InputIterator first, InputIterator last );Attempts to insert all items from the half-open interval
[first, last)into the container.If the interval
[first, last)contains multiple elements with equal keys, it is unspecified which element should be inserted.Requirements: the type
InputIteratormust meet the requirements of InputIterator from[input.iterators]ISO C++ Standard section.
void insert( std::initializer_list<value_type> init );Equivalent to
insert(init.begin(), init.end()).
Inserting nodes¶
std::pair<iterator, bool> insert( node_type&& nh );If the node handle
nhis empty, does nothing.Otherwise - attempts to insert the node, owned by
nhinto the container.If the insertion fails, node handle
nhremains ownership of the node.Otherwise -
nhis left in an empty state.No copy or move constructors of
value_typeare performed.The behavior is undefined if
nhis not empty andget_allocator() != nh.get_allocator().Returns:
std::pair<iterator, bool>whereiteratorpoints to the inserted element or to an existing element with key equal tonh.key(). Boolean value istrueif insertion took place,falseotherwise.
iterator insert( const_iterator hint, node_type&& nh );If the node handle
nhis empty, does nothing.Otherwise - attempts to insert the node, owned by
nhinto the container.Optionally uses the parameter
hintas a suggestion to where the node should be placed.If the insertion fails, node handle
nhremains ownership of the node.Otherwise -
nhis left in an empty state.No copy or move constructors of
value_typeare performed.The behavior is undefined if
nhis not empty andget_allocator() != nh.get_allocator().Returns: an iterator pointing to the inserted element or to an existing element with key equal to
nh.key().
Merging containers
template <typename SrcHash, typename SrcKeyEqual> void merge( concurrent_unordered_map<Key, T, SrcHash, SrcKeyEqual, Allocator>& source ); template <typename SrcHash, typename SrcKeyEqual> void merge( concurrent_unordered_map<Key, T, SrcHash, SrcKeyEqual, Allocator>&& source ); template <typename SrcHash, typename SrcKeyEqual> void merge( concurrent_unordered_multimap<Key, T, SrcHash, SrcKeyEqual, Allocator>& source ); template <typename SrcHash, typename SrcKeyEqual> void merge( concurrent_unordered_multimap<Key, T, SrcHash, SrcKeyEqual, Allocator>&& source );Transfers those elements from
sourcewhich keys do not exist in the container.In case of merging with the container with multiple elements with equal keys, it is unspecified which element would be transfered.
No copy or move constructors of
value_typeare performed.The behavior is undefined if
get_allocator() != source.get_allocator().