From Jason Turner

[iterator.cpp17]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjutysguy/{from.md → to.md} +21 -16
tmp/tmpjutysguy/{from.md → to.md} RENAMED
@@ -1,7 +1,9 @@
1
  ### C++17 iterator requirements <a id="iterator.cpp17">[[iterator.cpp17]]</a>
2
 
 
 
3
  In the following sections, `a` and `b` denote values of type `X` or
4
  `const X`, `difference_type` and `reference` refer to the types
5
  `iterator_traits<X>::difference_type` and
6
  `iterator_traits<X>::reference`, respectively, `n` denotes a value of
7
  `difference_type`, `u`, `tmp`, and `m` denote identifiers, `r` denotes a
@@ -16,19 +18,18 @@ value of some type that is writable to the output iterator.
16
  The *Cpp17Iterator* requirements form the basis of the iterator
17
  taxonomy; every iterator meets the *Cpp17Iterator* requirements. This
18
  set of requirements specifies operations for dereferencing and
19
  incrementing an iterator. Most algorithms will require additional
20
  operations to read [[input.iterators]] or write [[output.iterators]]
21
- values, or to provide a richer set of iterator movements (
22
- [[forward.iterators]], [[bidirectional.iterators]],
23
- [[random.access.iterators]]).
24
 
25
- A type `X` meets the *Cpp17Iterator* requirements if:
26
 
27
- - `X` meets the *Cpp17CopyConstructible*, *Cpp17CopyAssignable*, and
28
- *Cpp17Destructible* requirements [[utility.arg.requirements]] and
29
- lvalues of type `X` are swappable [[swappable.requirements]], and
30
  - `iterator_traits<X>::difference_type` is a signed integer type or
31
  `void`, and
32
  - the expressions in [[iterator]] are valid and have the indicated
33
  semantics.
34
 
@@ -50,31 +51,35 @@ uses that algorithm makes of `==` and `!=`.
50
  [*Example 1*: The call `find(a,b,x)` is defined only if the value of
51
  `a` has the property *p* defined as follows: `b` has property *p* and a
52
  value `i` has property *p* if (`*i==x`) or if (`*i!=x` and `++i` has
53
  property *p*). — *end example*]
54
 
 
 
 
 
55
  [*Note 1*: For input iterators, `a == b` does not imply `++a == ++b`.
56
  (Equality does not guarantee the substitution property or referential
57
- transparency.) Algorithms on input iterators should never attempt to
58
- pass through the same iterator twice. They should be *single pass*
59
- algorithms. Value type `T` is not required to be a *Cpp17CopyAssignable*
60
- type ([[cpp17.copyassignable]]). These algorithms can be used with
61
- istreams as the source of the input data through the `istream_iterator`
62
- class template. — *end note*]
63
 
64
  #### Output iterators <a id="output.iterators">[[output.iterators]]</a>
65
 
66
  A class or pointer type `X` meets the requirements of an output iterator
67
  if `X` meets the *Cpp17Iterator* requirements [[iterator.iterators]] and
68
  the expressions in [[outputiterator]] are valid and have the indicated
69
  semantics.
70
 
 
 
 
 
71
  [*Note 1*: The only valid use of an `operator*` is on the left side of
72
  the assignment statement. Assignment through the same value of the
73
- iterator happens only once. Algorithms on output iterators should never
74
- attempt to pass through the same iterator twice. They should be
75
- single-pass algorithms. Equality and inequality might not be
76
  defined. — *end note*]
77
 
78
  #### Forward iterators <a id="forward.iterators">[[forward.iterators]]</a>
79
 
80
  A class or pointer type `X` meets the requirements of a forward iterator
 
1
  ### C++17 iterator requirements <a id="iterator.cpp17">[[iterator.cpp17]]</a>
2
 
3
+ #### General <a id="iterator.cpp17.general">[[iterator.cpp17.general]]</a>
4
+
5
  In the following sections, `a` and `b` denote values of type `X` or
6
  `const X`, `difference_type` and `reference` refer to the types
7
  `iterator_traits<X>::difference_type` and
8
  `iterator_traits<X>::reference`, respectively, `n` denotes a value of
9
  `difference_type`, `u`, `tmp`, and `m` denote identifiers, `r` denotes a
 
18
  The *Cpp17Iterator* requirements form the basis of the iterator
19
  taxonomy; every iterator meets the *Cpp17Iterator* requirements. This
20
  set of requirements specifies operations for dereferencing and
21
  incrementing an iterator. Most algorithms will require additional
22
  operations to read [[input.iterators]] or write [[output.iterators]]
23
+ values, or to provide a richer set of iterator movements
24
+ [[forward.iterators]], [[bidirectional.iterators]], [[random.access.iterators]].
 
25
 
26
+ A type `X` meets the requirements if:
27
 
28
+ - `X` meets the *Cpp17CopyConstructible*, *Cpp17CopyAssignable*,
29
+ *Cpp17Swappable*, and *Cpp17Destructible* requirements
30
+ [[utility.arg.requirements]], [[swappable.requirements]], and
31
  - `iterator_traits<X>::difference_type` is a signed integer type or
32
  `void`, and
33
  - the expressions in [[iterator]] are valid and have the indicated
34
  semantics.
35
 
 
51
  [*Example 1*: The call `find(a,b,x)` is defined only if the value of
52
  `a` has the property *p* defined as follows: `b` has property *p* and a
53
  value `i` has property *p* if (`*i==x`) or if (`*i!=x` and `++i` has
54
  property *p*). — *end example*]
55
 
56
+ *Recommended practice:* The implementation of an algorithm on input
57
+ iterators should never attempt to pass through the same iterator twice;
58
+ such an algorithm should be a single pass algorithm.
59
+
60
  [*Note 1*: For input iterators, `a == b` does not imply `++a == ++b`.
61
  (Equality does not guarantee the substitution property or referential
62
+ transparency.) Value type `T` is not required to be a
63
+ *Cpp17CopyAssignable* type ([[cpp17.copyassignable]]). Such an
64
+ algorithm can be used with istreams as the source of the input data
65
+ through the `istream_iterator` class template. *end note*]
 
 
66
 
67
  #### Output iterators <a id="output.iterators">[[output.iterators]]</a>
68
 
69
  A class or pointer type `X` meets the requirements of an output iterator
70
  if `X` meets the *Cpp17Iterator* requirements [[iterator.iterators]] and
71
  the expressions in [[outputiterator]] are valid and have the indicated
72
  semantics.
73
 
74
+ *Recommended practice:* The implementation of an algorithm on output
75
+ iterators should never attempt to pass through the same iterator twice;
76
+ such an algorithm should be a single-pass algorithm.
77
+
78
  [*Note 1*: The only valid use of an `operator*` is on the left side of
79
  the assignment statement. Assignment through the same value of the
80
+ iterator happens only once. Equality and inequality are not necessarily
 
 
81
  defined. — *end note*]
82
 
83
  #### Forward iterators <a id="forward.iterators">[[forward.iterators]]</a>
84
 
85
  A class or pointer type `X` meets the requirements of a forward iterator