An insert iterator is a special type of output iterator specifically designed to allow algorithms that usually overwrite elements (such as copy) to instead insert new elements in the container.
Parameters
- x
- Container for which the insert iterator is constructed.
- i
- Iterator to the location in x where the element are to be inserted.
Return value
An insert_iterator that inserts elements in the container x at the location pointed by i.Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Output:
1 2 3 10 20 30 40 50 4 5 |
See also
| insert_iterator | Insert iterator (class template) |
| back_inserter | Construct a back insert iterator (function template) |
| front_inserter | Constructs a front insert iterator (function template) |
