25
Iterators library
[iterators]
25.3
Iterator requirements
[iterator.requirements]
25.3.4
Iterator concepts
[iterator.concepts]
25.3.4.10
Concept
output_
iterator
[iterator.concept.output]
1
#
The
output_
iterator
concept defines requirements for a type that can be used to write values (from the requirement for
indirectly_
writable
(
[iterator.
concept.
writable]
)) and which can be both pre- and post-incremented
.
[
Note
1
:
Output iterators are not required to model
equality_
comparable
.
—
end note
]
template
<
class
I,
class
T
>
concept
output_
iterator
=
input_
or_
output_
iterator
<
I
>
&
&
indirectly_
writable
<
I, T
>
&
&
requires
(
I i, T
&
&
t
)
{
*
i
+
+
=
std
::
forward
<
T
>
(
t
)
;
// not required to be equality-preserving
}
;
2
#
Let
E
be an expression such that
decltype
(
(
E
)
)
is
T
, and let
i
be a dereferenceable object of type
I
.
I
and
T
model
output_
iterator
<
I, T
>
only if
*
i
+
+
=
E;
has effects equivalent to:
*
i
=
E;
+
+
i;
3
#
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
.