[insert.iterators.general] (original) (raw)

An insert iterator is constructed from a container and possibly one of its iterators pointing to where insertion takes place if it is neither at the beginning nor at the end of the container.

Insert iterators meet the requirements of output iterators.

operator*returns the insert iterator itself.

The assignmentoperator=(const T& x)is defined on insert iterators to allow writing into them, it insertsxright before where the insert iterator is pointing.

In other words, an insert iterator is like a cursor pointing into the container where the insertion takes place.

back_insert_iteratorinserts elements at the end of a container,front_insert_iteratorinserts elements at the beginning of a container, andinsert_iteratorinserts elements where the iterator points to in a container.

back_inserter,front_inserter, andinserterare three functions making the insert iterators out of a container.