From Jason Turner

[iterator.requirements.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp07rfmzn5/{from.md → to.md} +10 -16
tmp/tmp07rfmzn5/{from.md → to.md} RENAMED
@@ -34,11 +34,11 @@ access iterators*, and *contiguous iterators*, as shown in
34
  The six categories of iterators correspond to the iterator concepts
35
 
36
  - `input_iterator` [[iterator.concept.input]],
37
  - `output_iterator` [[iterator.concept.output]],
38
  - `forward_iterator` [[iterator.concept.forward]],
39
- - `bidirectional_iterator` [[iterator.concept.bidir]]
40
  - `random_access_iterator` [[iterator.concept.random.access]], and
41
  - `contiguous_iterator` [[iterator.concept.contiguous]],
42
 
43
  respectively. The generic term *iterator* refers to any type that models
44
  the `input_or_output_iterator` concept [[iterator.concept.iterator]].
@@ -69,22 +69,16 @@ value pointing past the last element of the array, so for any iterator
69
  type there is an iterator value that points past the last element of a
70
  corresponding sequence. Such a value is called a *past-the-end value*.
71
  Values of an iterator `i` for which the expression `*i` is defined are
72
  called *dereferenceable*. The library never assumes that past-the-end
73
  values are dereferenceable. Iterators can also have singular values that
74
- are not associated with any sequence.
75
-
76
- [*Example 1*: After the declaration of an uninitialized pointer `x` (as
77
- with `int* x;`), `x` must always be assumed to have a singular value of
78
- a pointer. *end example*]
79
-
80
- Results of most expressions are undefined for singular values; the only
81
- exceptions are destroying an iterator that holds a singular value, the
82
- assignment of a non-singular value to an iterator that holds a singular
83
- value, and, for iterators that meet the *Cpp17DefaultConstructible*
84
- requirements, using a value-initialized iterator as the source of a copy
85
- or move operation.
86
 
87
  [*Note 2*: This guarantee is not offered for default-initialization,
88
  although the distinction only matters for types with trivial default
89
  constructors such as pointers or aggregates holding
90
  pointers. — *end note*]
@@ -105,18 +99,18 @@ elements in the data structure starting with the element pointed to by
105
  first iterator `j` such that `j == s`.
106
 
107
  A sentinel `s` is called *reachable from* an iterator `i` if and only if
108
  there is a finite sequence of applications of the expression `++i` that
109
  makes `i == s`. If `s` is reachable from `i`, \[`i`, `s`) denotes a
110
- valid range.
111
 
112
  A *counted range* `i`+\[0, `n`) is empty if `n == 0`; otherwise,
113
  `i`+\[0, `n`) refers to the `n` elements in the data structure starting
114
  with the element pointed to by `i` and up to but not including the
115
  element, if any, pointed to by the result of `n` applications of `++i`.
116
- A counted range `i`+\[0, `n`) is valid if and only if `n == 0`; or `n`
117
- is positive, `i` is dereferenceable, and `++i`+\[0, `-``-``n`) is valid.
118
 
119
  The result of the application of library functions to invalid ranges is
120
  undefined.
121
 
122
  All the categories of iterators require only those functions that are
 
34
  The six categories of iterators correspond to the iterator concepts
35
 
36
  - `input_iterator` [[iterator.concept.input]],
37
  - `output_iterator` [[iterator.concept.output]],
38
  - `forward_iterator` [[iterator.concept.forward]],
39
+ - `bidirectional_iterator` [[iterator.concept.bidir]],
40
  - `random_access_iterator` [[iterator.concept.random.access]], and
41
  - `contiguous_iterator` [[iterator.concept.contiguous]],
42
 
43
  respectively. The generic term *iterator* refers to any type that models
44
  the `input_or_output_iterator` concept [[iterator.concept.iterator]].
 
69
  type there is an iterator value that points past the last element of a
70
  corresponding sequence. Such a value is called a *past-the-end value*.
71
  Values of an iterator `i` for which the expression `*i` is defined are
72
  called *dereferenceable*. The library never assumes that past-the-end
73
  values are dereferenceable. Iterators can also have singular values that
74
+ are not associated with any sequence. Results of most expressions are
75
+ undefined for singular values; the only exceptions are destroying an
76
+ iterator that holds a singular value, the assignment of a non-singular
77
+ value to an iterator that holds a singular value, and, for iterators
78
+ that meet the *Cpp17DefaultConstructible* requirements, using a
79
+ value-initialized iterator as the source of a copy or move operation.
 
 
 
 
 
 
80
 
81
  [*Note 2*: This guarantee is not offered for default-initialization,
82
  although the distinction only matters for types with trivial default
83
  constructors such as pointers or aggregates holding
84
  pointers. — *end note*]
 
99
  first iterator `j` such that `j == s`.
100
 
101
  A sentinel `s` is called *reachable from* an iterator `i` if and only if
102
  there is a finite sequence of applications of the expression `++i` that
103
  makes `i == s`. If `s` is reachable from `i`, \[`i`, `s`) denotes a
104
+ *valid range*.
105
 
106
  A *counted range* `i`+\[0, `n`) is empty if `n == 0`; otherwise,
107
  `i`+\[0, `n`) refers to the `n` elements in the data structure starting
108
  with the element pointed to by `i` and up to but not including the
109
  element, if any, pointed to by the result of `n` applications of `++i`.
110
+ A counted range `i`+\[0, `n`) is *valid* if and only if `n == 0`; or `n`
111
+ is positive, `i` is dereferenceable, and `++i`+\[0, `n`) is valid.
112
 
113
  The result of the application of library functions to invalid ranges is
114
  undefined.
115
 
116
  All the categories of iterators require only those functions that are