tmp/tmplhic53l9/{from.md → to.md}
RENAMED
|
@@ -93,27 +93,27 @@ The members of a specialization `iterator_traits<I>` generated from the
|
|
| 93 |
|
| 94 |
- If `I` has valid [[temp.deduct]] member types `difference_type`,
|
| 95 |
`value_type`, `reference`, and `iterator_category`, then
|
| 96 |
`iterator_traits<I>` has the following publicly accessible members:
|
| 97 |
``` cpp
|
| 98 |
-
using iterator_category =
|
| 99 |
-
using value_type =
|
| 100 |
-
using difference_type =
|
| 101 |
using pointer = see below;
|
| 102 |
-
using reference =
|
| 103 |
```
|
| 104 |
|
| 105 |
If the *qualified-id* `I::pointer` is valid and denotes a type, then
|
| 106 |
`iterator_traits<I>::pointer` names that type; otherwise, it names
|
| 107 |
`void`.
|
| 108 |
- Otherwise, if `I` satisfies the exposition-only concept
|
| 109 |
`cpp17-input-iterator`, `iterator_traits<I>` has the following
|
| 110 |
publicly accessible members:
|
| 111 |
``` cpp
|
| 112 |
using iterator_category = see below;
|
| 113 |
-
using value_type =
|
| 114 |
-
using difference_type =
|
| 115 |
using pointer = see below;
|
| 116 |
using reference = see below;
|
| 117 |
```
|
| 118 |
|
| 119 |
- If the *qualified-id* `I::pointer` is valid and denotes a type,
|
|
@@ -183,16 +183,14 @@ To implement a generic `reverse` function, a C++ program can do the
|
|
| 183 |
following:
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
template<class BI>
|
| 187 |
void reverse(BI first, BI last) {
|
| 188 |
-
typename iterator_traits<BI>::difference_type n =
|
| 189 |
-
distance(first, last);
|
| 190 |
--n;
|
| 191 |
while (n > 0) {
|
| 192 |
-
typename iterator_traits<BI>::value_type
|
| 193 |
-
tmp = *first;
|
| 194 |
*first++ = *--last;
|
| 195 |
*last = tmp;
|
| 196 |
n -= 2;
|
| 197 |
}
|
| 198 |
}
|
|
|
|
| 93 |
|
| 94 |
- If `I` has valid [[temp.deduct]] member types `difference_type`,
|
| 95 |
`value_type`, `reference`, and `iterator_category`, then
|
| 96 |
`iterator_traits<I>` has the following publicly accessible members:
|
| 97 |
``` cpp
|
| 98 |
+
using iterator_category = I::iterator_category;
|
| 99 |
+
using value_type = I::value_type;
|
| 100 |
+
using difference_type = I::difference_type;
|
| 101 |
using pointer = see below;
|
| 102 |
+
using reference = I::reference;
|
| 103 |
```
|
| 104 |
|
| 105 |
If the *qualified-id* `I::pointer` is valid and denotes a type, then
|
| 106 |
`iterator_traits<I>::pointer` names that type; otherwise, it names
|
| 107 |
`void`.
|
| 108 |
- Otherwise, if `I` satisfies the exposition-only concept
|
| 109 |
`cpp17-input-iterator`, `iterator_traits<I>` has the following
|
| 110 |
publicly accessible members:
|
| 111 |
``` cpp
|
| 112 |
using iterator_category = see below;
|
| 113 |
+
using value_type = indirectly_readable_traits<I>::value_type;
|
| 114 |
+
using difference_type = incrementable_traits<I>::difference_type;
|
| 115 |
using pointer = see below;
|
| 116 |
using reference = see below;
|
| 117 |
```
|
| 118 |
|
| 119 |
- If the *qualified-id* `I::pointer` is valid and denotes a type,
|
|
|
|
| 183 |
following:
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
template<class BI>
|
| 187 |
void reverse(BI first, BI last) {
|
| 188 |
+
typename iterator_traits<BI>::difference_type n = distance(first, last);
|
|
|
|
| 189 |
--n;
|
| 190 |
while (n > 0) {
|
| 191 |
+
typename iterator_traits<BI>::value_type tmp = *first;
|
|
|
|
| 192 |
*first++ = *--last;
|
| 193 |
*last = tmp;
|
| 194 |
n -= 2;
|
| 195 |
}
|
| 196 |
}
|