27 Iterators library [iterators]

27.2 Iterator requirements [iterator.requirements]

27.2.4 Output iterators [output.iterators]

A class or pointer type X satisfies the requirements of an output iterator if X satisfies the Iterator requirements ([iterator.iterators]) and the expressions in Table 91 are valid and have the indicated semantics.
Table 91 — Output iterator requirements (in addition to Iterator)
Expression
Return type
Operational
Assertion/note
semantics
pre-/post-condition
*r = o
result is not used
Remarks: After this operation r is not required to be dereferenceable.

Postconditions: r is incrementable.
++r
X&
&r == &++r.

Remarks: After this operation r is not required to be dereferenceable.

Postconditions: r is incrementable.
r++
convertible to const X&
{ X tmp = r;
++r;
return tmp; }
Remarks: After this operation r is not required to be dereferenceable.

Postconditions: r is incrementable.
*r++ = o
result is not used
Remarks: After this operation r is not required to be dereferenceable.

Postconditions: r is incrementable.
[Note
:
The only valid use of an operator* is on the left side of the assignment statement.
Assignment through the same value of the iterator happens only once. Algorithms on output iterators should never attempt to pass through the same iterator twice.
They should be single pass algorithms.
Equality and inequality might not be defined.
Algorithms that take output iterators can be used with ostreams as the destination for placing data through the ostream_­iterator class as well as with insert iterators and insert pointers.
end note
]