| Home | Libraries | People | FAQ | More

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

Insert elements before the specified location.

###### Synopsis

    iterator
    insert(
        const_iterator pos,
        std::initializer_list< value_ref > init);

###### Description

The elements in the initializer list `init` are inserted in order. If `capacity() < size() + init.size()`, 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 `init.size() + 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.
`init` | The initializer list to insert

###### Return Value

An iterator to the first inserted value, or `pos` if `init.size() == 0`.