Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit 69109f5924.
PrevUpHomeNext
object::insert (2 of 3 overloads)

Insert elements.

Synopsis
template<
    class InputIt>
void
insert(
    InputIt first,
    InputIt last);
Description

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.

Precondition

first and last are not iterators into *this. first and last form a valid range.

Constraints
std::is_constructible_v<value_type, std::iterator_traits<InputIt>::reference>
Complexity

Linear in std::distance(first, last).

Exception Safety

Strong guarantee for forward iterators, basic guarantee for input iterators. Calls to memory_resource::allocate may throw.

Parameters

Name

Description

first

An input iterator pointing to the first element to insert, or pointing to the end of the range.

last

An input iterator pointing to the end of the range.

Template Parameters

Type

Description

InputIt

a type satisfying the requirements of InputIterator.


PrevUpHomeNext