From Jason Turner

[iterator.concept.output]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp77z3wk4n/{from.md → to.md} +33 -0
tmp/tmp77z3wk4n/{from.md → to.md} RENAMED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Concept <a id="iterator.concept.output">[[iterator.concept.output]]</a>
2
+
3
+ The `output_iterator` concept defines requirements for a type that can
4
+ be used to write values (from the requirement for `indirectly_writable`
5
+ [[iterator.concept.writable]]) and which can be both pre- and
6
+ post-incremented.
7
+
8
+ [*Note 1*: Output iterators are not required to model
9
+ `equality_comparable`. — *end note*]
10
+
11
+ ``` cpp
12
+ template<class I, class T>
13
+ concept output_iterator =
14
+ input_or_output_iterator<I> &&
15
+ indirectly_writable<I, T> &&
16
+ requires(I i, T&& t) {
17
+ *i++ = std::forward<T>(t); // not required to be equality-preserving
18
+ };
19
+ ```
20
+
21
+ Let `E` be an expression such that `decltype((E))` is `T`, and let `i`
22
+ be a dereferenceable object of type `I`. `I` and `T` model
23
+ `output_iterator<I, T>` only if `*i++ = E;` has effects equivalent to:
24
+
25
+ ``` cpp
26
+ *i = E;
27
+ ++i;
28
+ ```
29
+
30
+ [*Note 2*: Algorithms on output iterators should never attempt to pass
31
+ through the same iterator twice. They should be single-pass
32
+ algorithms. — *end note*]
33
+