| Home | Libraries | People | FAQ | More

###### array::insert (3 of 5 overloads)

Insert elements before the specified location.

<h7> Synopsis </h7>

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

<h7> Description </h7>

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.

<h7> Complexity </h7>

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

<h7> Exception Safety </h7>

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

<h7> Parameters </h7>

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 container's associated `memory_resource`.

<h7> Return Value </h7>

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