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 accessor
resultis 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 that was already presented in the container.Requirements:
the type
value_typemust meet theEmplaceConstructiblerequirements the from [container.requirements] ISO C++ Standard section.the type
mapped_typemust meet theDefaultConstructiblerequirements from the [defaultconstructible] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise.
bool insert( const_accessor& result, const value_type& value ); bool insert( accessor& result, const value_type& value );If the accessor
resultis 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 that was already presented in the container.Requirements: the type
value_typemust meet theCopyInsertablerequirements from the [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise.
bool insert( const value_type& value );Attempts to insert the value
valueinto the container.Requirements: the type
value_typemust meet theCopyInsertablerequirements from the [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise.
bool insert( const_accessor& result, value_type&& value ); bool insert( accessor& result, value_type&& value );If the accessor
resultis 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 that was already presented in the container.
valueis left in a valid, but unspecified state.Requirements: the type
value_typemust meet theMoveInsertablerequirements from the [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise.
bool insert( value_type&& value );Attempts to insert the value
valueinto the container using move semantics.Requirements: the type
value_typemust meet theMoveInsertablerequirements from the [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise.
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 the[input.iterators]ISO C++ Standard section.
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 accessor
resultis 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 that was already presented in the container.Requirements: the type
value_typemust meet theEmplaceConstructiblerequirements from the [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise
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 from the [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted;false, otherwise
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 was removed;false, otherwise.
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 was removed by the current thread;falseif it was removed by another thread.