[output.iterators] (original) (raw)
23 Iterators library [iterators]
23.3 Iterator requirements [iterator.requirements]
23.3.5 C++17 iterator requirements [iterator.cpp17]
23.3.5.3 Output iterators [output.iterators]
A class or pointer typeXmeets the requirements of an output iterator if X meets the Cpp17Iterator requirements ([iterator.iterators]) and the expressions in Table 86are valid and have the indicated semantics.
Table 86: Cpp17OutputIterator requirements (in addition to Cpp17Iterator) [tab:outputiterator]
| 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& | addressof(r) == addressof(++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 anoperator*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.
— end note
]