Files
2025-10-25 03:02:53 +03:00

3.0 KiB

[output.iterators]

24 Iterators library [iterators]

24.3 Iterator requirements [iterator.requirements]

24.3.5 C++17 iterator requirements [iterator.cpp17]

24.3.5.4 Output iterators [output.iterators]

1

#

A class or pointer typeX meets the requirements of an output iterator if X meets the Cpp17Iterator requirements ([iterator.iterators]) and the expressions in Table 80 are valid and have the indicated semantics.

Table 80Cpp17OutputIterator 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.

2

#

Recommended practice: The implementation of an algorithm on output iterators should never attempt to pass through the same iterator twice; such an algorithm should be a single-pass algorithm.

[Note 1:

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.

Equality and inequality are not necessarily defined.

— end note]