Insert a copy of value at position.

Synopsis

Declared in <bslstl_vector.h>

vector<VALUE_TYPE, ALLOCATOR>::iterator
insert(
    const_iterator position,
    VALUE_TYPE const& value);

Description

Insert at the specified position in this vector a copy of the specified value, and return an iterator referring to the newly inserted element. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of VALUE_TYPE), *this is unaffected. Throw std::length_error if size() == max_size(). The behavior is undefined unless position is an iterator in the range [begin() .. end()] (both endpoints included). This method requires that the (template parameter) type VALUE_TYPE be copy‐insertable into this vector (see {Requirements on VALUE_TYPE}).

Return Value

iterator referring to the newly inserted element

Parameters

Name

Description

position

iterator before which to insert

value

element to copy‐insert

Created with MrDocs