Concurrently safe modifiers#
All methods in this section can be executed concurrently with each other and lookup methods.
Inserting values#
bool insert( const_accessor& result, const key_type& key ); bool insert( accessor& result, const key_type& key );If the
resultaccessor is not empty, releases theresultand attempts to insert the value constructed fromkey, mapped_type()into the container.Sets the
resultto provide access to the inserted element or to the element with equal key, which was already presented in the container.Requirements:
the
value_typetype must meet theEmplaceConstructiblerequirements described in the [container.requirements] section of the ISO C++ Standard.the
mapped_typetype must meet theDefaultConstructiblerequirements described in the [defaultconstructible] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise.
template <typename K> bool insert( const_accessor& result, const K& key ); template <typename K> bool insert( accessor& result, const K& key );If the
resultaccessor is not empty, releases theresultand attempts to insert the value constructed fromkey, mapped_type()into the container.Sets the
resultto provide access to the inserted element or to the element with the key, that compares equivalent to the valuekey, which was already presented in the container.This overload only participates in the overload resolution if:
qualified-id
hash_compare_type::is_transparentis valid and denotes a type
std::is_constructible<key_type, const K&>::valueistrueRequirements: the
mapped_typetype must meet theDefaultConstructiblerequirements described in the [defaultconstructible] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise.
bool insert( const_accessor& result, const value_type& value ); bool insert( accessor& result, const value_type& value );If the
resultaccessor is not empty, releases theresultand attempts to insert the valuevalueinto the container.Sets the
resultto provide access to the inserted element or to the element with equal key, which was already presented in the container.Requirements: the
value_typetype must meet theCopyInsertablerequirements described in the [container.requirements] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise.
bool insert( const value_type& value );Attempts to insert the value
valueinto the container.Requirements: the
value_typetype must meet theCopyInsertablerequirements described in the [container.requirements] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise.
bool insert( const_accessor& result, value_type&& value ); bool insert( accessor& result, value_type&& value );If the
resultaccessor is not empty, releases theresultand attempts to insert the valuevalueinto the container using move semantics.Sets the
resultto provide access to the inserted element or to the element with equal key, which was already presented in the container.
valueis left in a valid, but unspecified state.Requirements: the
value_typetype must meet theMoveInsertablerequirements described in the [container.requirements] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise.
bool insert( value_type&& value );Attempts to insert the value
valueinto the container using move semantics.Requirements: the
value_typetype must meet theMoveInsertablerequirements described in the [container.requirements] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise.
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
InputIteratortype must meet the requirements of InputIterator described in the[input.iterators]section of the ISO C++ Standard.
void insert( std::initializer_list<value_type> init );Equivalent to
insert(init.begin(), init.end()).
Emplacing elements#
template <typename... Args> bool emplace( const_accessor& result, Args&&... args ); template <typename... Args> bool emplace( accessor& result, Args&&... args );If the
resultaccessor is not empty, releases theresultand attempts to insert an element constructed in-place fromargsinto the container.Sets the
resultto provide access to the inserted element or to the element with equal key, which was already presented in the container.Requirements: the type
value_typemust meet theEmplaceConstructiblerequirements described in the [container.requirements] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise
template <typename... Args> bool emplace( Args&&... args );Attempts to insert an element constructed in-place from
argsinto the container.Requirements: the type
value_typemust meet theEmplaceConstructiblerequirements described in the [container.requirements] section of the ISO C++ Standard.Returns:
trueif an element is inserted;falseotherwise
Erasing elements#
bool erase( const key_type& key );If an element with the key equivalent to
keyexists, removes it from the container.Returns:
trueif an element is removed;falseotherwise.
template <typename K> bool erase( const K& key );If an element with the key that compares equivalent to the value
keyexists, removes it from the container.This overload only participates in the overload resolution if qualified-id
hash_compare_type::is_transparentis valid and denotes a type.Returns:
trueif an element is removed;falseotherwise.
bool erase( const_accessor& item_accessor ); bool erase( accessor& item_accessor );Removes an element owned by
item_accessorfrom the container.Requirements:
item_accessorshould not be empty.Returns:
trueif an element is removed by the current thread;falseif it is removed by another thread.