public member function
<unordered_set>
std::unordered_set::emplace_hinttemplate <class... Args>iterator emplace_hint ( const_iterator position, Args&&... args );
Construct and insert element with hint
Inserts a new element in the unordered_set if its value is unique. This new element is constructed in place using args as the arguments for the element's constructor. position points to a location in the container suggested as a hint on where to start the search for its insertion point (the container may or may not use this suggestion to optimize the insertion operation).The insertion only takes place if no element in the container has a value equivalent to the one being emplaced (elements in an unordered_set have unique values).
If inserted, this effectively increases the container size by one.
A similar member function exists, insert, which either copies or moves an existing object into the container, and may also take a position hint.
Otherwise, it returns an iterator pointing to the element in the container that compared equivalent to it (it is not replaced).
Member type iterator is a forward iterator type.
All iterators in an unordered_set have const access to the elements: Elements can be inserted or removed, but not modified while in the container.
The storage for the new element is allocated using allocator_traits<allocator_type>::construct(), which may throw exceptions on failure (for the default allocator, bad_alloc is thrown if the allocation request does not succeed).
A rehash is forced if the new container size after the insertion operation would increase above its capacity threshold (calculated as the container's bucket_count multiplied by its max_load_factor).
References remain valid in all cases, even after a rehash.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4