pair<iterator, bool> insert(const value_type& x);
iterator insert(iterator it, const value_type& x);
void insert(const value_type *first, const value_type *last);
The first member function determines whether an element y
exists in the sequence whose key matches that of x
. (The
keys match if !
key_comp
()(x.
first
, y.first) && !key_comp()(y.first, x.first)
.) If not, it creates
such an element y
and initializes it with x
. The function then determines the iterator it
that designates y
. If an insertion
occurred, the function returns pair
(it, true)
. Otherwise, it returns pair(it, false)
.
The second member function returns insert(x)
, using it
as a starting place within the controlled sequence to search
for the insertion point. (Insertion can occur in amortized constant time, instead of logarithmic time, if the insertion point
immediately follows it
.) The third member function inserts the sequence of element values in the range [first,
last)
.
In this implementation, if a translator does not support member template functions, the template:
template<class InIt>
void insert(InIt first, InIt last);
is replaced by:
void insert(const value_type *first, const value_type *last);
See the related sample program.