unordered_set::emplace_hint
Inserts an element constructed in place (no copy or move operations are performed), with a placement hint.
template<class... Args>
iterator emplace_hint(
const_iterator where,
Args&&... args);
Parameters
Parameter |
Description |
args |
The arguments forwarded to construct an element to be inserted into the unordered_set unless the unordered_set already contains that element or, more generally, unless it already contains an element whose key is equivalently ordered. |
where |
A hint regarding the place to start searching for the correct point of insertion. |
Return Value
An iterator to the newly inserted element.
If the insertion failed because the element already exists, returns an iterator to the existing element.
Remarks
No iterators or references are invalidated by this function.
During the insertion, if an exception is thrown but does not occur in the container's hash function, the container is not modified. If the exception is thrown in the hash function, the result is undefined.
For a code example, see set::emplace_hint.
Requirements
Header: <unordered_set>
Namespace: std