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 which was already presented in the container.Requirements:
the type
value_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ Standard section..the type
mapped_typeshall meet theDefaultConstructiblerequirements from [defaultconstructible] ISO C++ Standard section..Returns:
trueif an element was inserted,falseotherwise.
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 attepts 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 type
value_typeshall meet theCopyInsertablerequirements from [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted,falseotherwise.
bool insert( const value_type& value );Attepts to insert the value
valueinto the container.Requirements: the type
value_typeshall meet theCopyInsertablerequirements from [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted,falseotherwise.
bool insert( const_accessor& result, value_type&& value ); bool insert( accessor& result, value_type&& value );If the accessor
resultis not empty - releases theresultand attepts 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 type
value_typeshall meet theMoveInsertablerequirements from [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted,falseotherwise.
bool insert( value_type&& value );Attempts to insert the value
valueinto the container using move semantics.Requirements: the type
value_typeshall meet theMoveInsertablerequirements from [container.requirements] ISO C++ Standard section.Returns:
trueif an element was 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 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()).
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 attepts 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_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted,falseotherwise
template <typename... Args> bool emplace( Args&&... args );Attepts to insert an element constructed in-place from
argsinto the container.Requirements: the type
value_typeshall meet theEmplaceConstructiblerequirements from [container.requirements] ISO C++ Standard section.Returns:
trueif an element was inserted,falseotherwise
Erasing elements¶
bool erase( const key_type& key );If an elemnent with the key equal to
keyexists - removes it from the container.Returns:
trueif an element was 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 was removed by the current thread,falseif it was removed by an other thread.