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

PrevUpHomeNext
array::insert (3 of 5 overloads)

Insert elements before the specified location.

Synopsis
iterator
insert(
    const_iterator pos,
    std::size_t count,
    value const& v);
Description

This inserts count copies of v before pos. If capacity() < size() + count, 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.

Complexity

Linear in count + std::distance(pos, end()).

Exception Safety

Strong guarantee. Calls to memory_resource::allocate may throw.

Parameters

Name

Description

pos

Iterator before which the content will be inserted. This may be the end() iterator.

count

The number of copies to insert.

v

The value to insert. Copies will be made using the container's associated boost::container::pmr::memory_resource.

Return Value

An iterator to the first inserted value, or pos if count == 0.


PrevUpHomeNext