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 e325ef413c.
PrevUpHomeNext
array::insert (2 of 5 overloads)

Insert elements before the specified location.

Synopsis
iterator
insert(
    const_iterator pos,
    value&& v);
Description

This inserts v before pos via move-construction. If capacity() < size() + 1, 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

Constant plus linear in 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.

v

The value to insert. Ownership of the value will be transferred via move construction, using the container's associated boost::container::pmr::memory_resource.

Return Value

An iterator to the inserted value


PrevUpHomeNext