[output.iterators]

# 24 Iterators library [[iterators]](./#iterators)

## 24.3 Iterator requirements [[iterator.requirements]](iterator.requirements#output.iterators)

### 24.3.5 C++17 iterator requirements [[iterator.cpp17]](iterator.cpp17#output.iterators)

#### 24.3.5.4 Output iterators [output.iterators]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2174)

A class or pointer typeX meets the requirements of an output iterator
if X meets the *Cpp17Iterator* requirements ([[iterator.iterators]](iterator.iterators "24.3.5.2 Cpp17Iterator"))
and the expressions in Table [80](#tab:outputiterator "Table 80: Cpp17OutputIterator requirements (in addition to Cpp17Iterator)") are valid and have the indicated semantics[.](#1.sentence-1)

Table [80](#tab:outputiterator) — *Cpp17OutputIterator* requirements (in addition to *Cpp17Iterator*) [[tab:outputiterator]](./tab:outputiterator)  

| [ð](#tab:outputiterator-row-1)<br>**Expression** | **Return type** | **Operational** | **Assertion/note** |
| --- | --- | --- | --- |
| [ð](#tab:outputiterator-row-2) |  | **semantics** | **pre-/post-condition** |
| [ð](#tab:outputiterator-row-3)<br>*r = o | result is not used |  | *Remarks*: After this operation r is not required to be dereferenceable[.](#tab:outputiterator-row-3-column-4-sentence-1)<br>   *Postconditions*: r is incrementable[.](#tab:outputiterator-row-3-column-4-sentence-2) |
| [ð](#tab:outputiterator-row-4)<br>++r | X& |  | addressof(r) == addressof(++r)[.](#tab:outputiterator-row-4-column-4-sentence-1)<br>   *Remarks*: After this operation r is not required to be dereferenceable[.](#tab:outputiterator-row-4-column-4-sentence-2)<br>   *Postconditions*: r is incrementable[.](#tab:outputiterator-row-4-column-4-sentence-3) |
| [ð](#tab:outputiterator-row-5)<br>r++ | convertible to const X& | { X tmp = r;    ++r;    return tmp; } | *Remarks*: After this operation r is not required to be dereferenceable[.](#tab:outputiterator-row-5-column-4-sentence-1)<br>   *Postconditions*: r is incrementable[.](#tab:outputiterator-row-5-column-4-sentence-2) |
| [ð](#tab:outputiterator-row-6)<br>*r++ = o | result is not used |  | *Remarks*: After this operation r is not required to be dereferenceable[.](#tab:outputiterator-row-6-column-4-sentence-1)<br>   *Postconditions*: r is incrementable[.](#tab:outputiterator-row-6-column-4-sentence-2) |

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2216)

*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[.](#2.sentence-1)

[*Note [1](#note-1)*:

The only valid use of an operator* is on the left side of the assignment statement[.](#2.sentence-2)

Assignment through the same value of the iterator happens only once[.](#2.sentence-3)

Equality and inequality are not necessarily defined[.](#2.sentence-4)

â *end note*]
