Modifiers

The following tables provides additional information on the members of the concurrent_unordered_set and concurrent_unordered_multiset template classes.
Member Description
std::pair<iterator, bool> insert(const value_type& x)

Constructs copy of x and attempts to insert it into the set. If the attempt fails because an item with the same key already exists, the copy is destroyed.

Returns: std::pair(iterator,success). The value iterator points to an item in the set with a matching key. The value of success is true if the item was inserted; false otherwise.

iterator insert(const_iterator hint, const value_type& x)

Same as insert(x).

Note

The current implementation ignores the hint argument. Other implementations might not ignore it. It exists for similarity with the C++11 classes unordered_set and unordered_multiset. It hints to the implementation about where to start searching. Typically it should point to an item adjacent to where the item will be inserted.

Returns: Iterator pointing to inserted item, or item already in the set with the same key.

std::pair<iterator, bool> insert(value_type&& x)

C++11 specific. Moves x into new instance of value_type and attempts to insert it into the set. If the attempt fails because an item with the same key already exists, this instance is destroyed.

Returns: the same as insert(const value_type& x) version.

iterator insert(const_iterator hint, value_type&& x)

Same as insert(x).

Note

The current implementation ignores the hint argument. Other implementations might not ignore it. It exists for similarity with the C++11 classes unordered_set and unordered_multiset. It hints to the implementation about where to start searching. Typically it should point to an item adjacent to where the item will be inserted.

Returns: the same as insert(const_iterator hint, const value_type& x) version.

template<class InputIterator> void insert(InputIterator first, InputIterator last)

Does insert(*i) where i is in the half-open interval [first,last).

void insert(std::initializer_list<value_type> il)

C++11 specific. Inserts a sequence to the set by inserting each element from the initializer list.

template<typename... Args> std::pair<iterator, bool> emplace(Args&&... args);

C++11 specific. Constructs new instance of value_type from args and attempts to insert it into the set. If the attempt fails because an item with the same key already exists, this instance is destroyed.

Returns: the same as insert(const value_type& x) version.

template<typename... Args> iterator emplace_hint(const_iterator hint, Args&&... args);

Same as emplace(args).

Note

The current implementation ignores the hint argument. Other implementations might not ignore it. It exists for similarity with the C++11 classes unordered_set and unordered_multiset. It hints to the implementation about where to start searching. Typically it should point to an item adjacent to where the item will be inserted.

Returns: Iterator pointing to inserted item, or item already in the set with the same key.

iterator unsafe_erase(const_iterator position)

Removes the item pointed to by position from the set.

Returns: Iterator pointing to item that was immediately after the erased item, or end() if erased item was the last item in the set.

size_type unsafe_erase(const key_type& k)

Removes item with key k if such an item exists.

Returns: 1 if an item was removed; 0 otherwise.

iterator unsafe_erase(const_iterator first, const_iterator last)

Removes *i where i is in the half-open interval [first,last).

Returns: last

void clear()

Removes all items from the set.

The following table provides additional information on the concurrent_unordered_set template class.
Member Description
void swap(concurrent_unordered_set& m)

Swaps contents of *this and m.

The following table provides additional information on the concurrent_unordered_multiset template class.
Member Description
void swap(concurrent_unordered_multiset& m)

Swaps contents of *this and m.

Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.