...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 before the specified location.
iterator insert( const_iterator pos, std::initializer_list< value_ref > init);
The elements in the initializer list init
are inserted in order. If capacity() < size() + init.size()
, a reallocation occurs first, and all
iterators and references are invalidated. Otherwise, only the iterators
and references from the insertion point forward are invalidated. All
past-the-end iterators are also invalidated.
Linear in init.size() + std::distance(pos, end())
.
Strong guarantee. Calls to memory_resource::allocate
may throw.
Name |
Description |
---|---|
|
Iterator before which the content will be inserted. This may
be the |
|
The initializer list to insert |
An iterator to the first inserted value, or pos
if init.size() == 0
.