...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Insert elements.
template< class P> std::pair< iterator, bool > insert( P&& p);
Inserts p
, from which
value_type
must be constructible.
std::is_constructible_v<value_type, P>
Average case amortized constant, worst case linear in size()
.
Strong guarantee. Calls to memory_resource::allocate
may throw.
Name |
Description |
---|---|
|
The value to insert. |
Type |
Thrown On |
---|---|
|
key is too long. |
|
|
A pair where first
is
an iterator to the existing or inserted element, and second
is true
if the insertion
took place or false
if the
assignment took place.