![]() |
Home | Libraries | People | FAQ | More |
Insert elements.
template< class P>std::pair
<object::iterator
, bool > insert( P&& p);
Inserts p
if this->contains(value_type(p).key())
is false
. value_type
must be constructible
from p
.
If the insertion occurs and results in a rehashing of the container,
all iterators and references are invalidated. Otherwise, they are not
affected. Rehashing occurs only if the new number of elements is greater
than capacity()
.
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 |
---|---|
boost::system::system_error |
key is too long. |
boost::system::system_error |
|
A pair where first
is
an iterator to the existing or inserted element, and second
is true
if the insertion
took place or false
otherwise.