Lecture overview -- Keyboard shortcut: 'u'  Previous page: Categories of iterators -- Keyboard shortcut: 'p'  Next page: Standard Containers [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Templates and The Standard Library - slide 21 : 39

Insert iterators

Many algorithms overwrites existing elements

It is also necessary to be able to insert new elements

Insertion is done by the container operations push_back(), push_front(), and insert()

Insertion can also be accomplished via insert-iterators, which are output iterators

Insertion iterators can be created by the template (factory) functions back_inserter, front_inserter, and inserter.

Using these, assignments are used for inserting new elements

ins-2.cpp
Output insert-iterators and factory functions that create such iterators.