...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 InputIt> void insert( InputIt first, InputIt last);
The elements in the range [first, last)
are inserted one at a time, in order. Any element with key that is a
duplicate of a key already present in container will be skipped. This
also means, that if there are two keys within the range that are equal
to each other, only the first will be inserted. Insertion may result
in rehashing of the container. In that case all iterators and references
are invalidated. Otherwise, they are not affected.
first
and last
are not iterators into *this
.
first
and last
form a valid range.
std::is_constructible_v<value_type, std::iterator_traits<InputIt>::value_type>
Linear in std::distance(first, last)
.
Strong guarantee for forward iterators, basic guarantee for input iterators.
Calls to memory_resource::allocate
may throw.
Name |
Description |
---|---|
|
An input iterator pointing to the first element to insert, or pointing to the end of the range. |
|
An input iterator pointing to the end of the range. |
Type |
Description |
---|---|
|
a type satisfying the requirements of InputIterator. |