tmp/tmp0lddkqpp/{from.md → to.md}
RENAMED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
## Range access <a id="iterator.range">[[iterator.range]]</a>
|
| 2 |
|
| 3 |
In addition to being available via inclusion of the `<iterator>` header,
|
| 4 |
the function templates in [[iterator.range]] are available when any of
|
| 5 |
the following headers are included: `<array>`, `<deque>`,
|
| 6 |
-
`<forward_list>`, `<list>`, `<map>`, `<regex>`, `<set>`, `<
|
| 7 |
-
`<
|
|
|
|
|
|
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
template<class C> constexpr auto begin(C& c) -> decltype(c.begin());
|
| 11 |
template<class C> constexpr auto begin(const C& c) -> decltype(c.begin());
|
| 12 |
```
|
|
@@ -94,5 +96,234 @@ template <class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)
|
|
| 94 |
template<class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));
|
| 95 |
```
|
| 96 |
|
| 97 |
*Returns:* `std::rend(c)`.
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
## Range access <a id="iterator.range">[[iterator.range]]</a>
|
| 2 |
|
| 3 |
In addition to being available via inclusion of the `<iterator>` header,
|
| 4 |
the function templates in [[iterator.range]] are available when any of
|
| 5 |
the following headers are included: `<array>`, `<deque>`,
|
| 6 |
+
`<forward_list>`, `<list>`, `<map>`, `<regex>`, `<set>`, `<span>`,
|
| 7 |
+
`<string>`, `<string_view>`, `<unordered_map>`, `<unordered_set>`, and
|
| 8 |
+
`<vector>`. Each of these templates is a designated customization point
|
| 9 |
+
[[namespace.std]].
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
template<class C> constexpr auto begin(C& c) -> decltype(c.begin());
|
| 13 |
template<class C> constexpr auto begin(const C& c) -> decltype(c.begin());
|
| 14 |
```
|
|
|
|
| 96 |
template<class C> constexpr auto crend(const C& c) -> decltype(std::rend(c));
|
| 97 |
```
|
| 98 |
|
| 99 |
*Returns:* `std::rend(c)`.
|
| 100 |
|
| 101 |
+
``` cpp
|
| 102 |
+
template<class C> constexpr auto size(const C& c) -> decltype(c.size());
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
*Returns:* `c.size()`.
|
| 106 |
+
|
| 107 |
+
``` cpp
|
| 108 |
+
template<class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept;
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
*Returns:* `N`.
|
| 112 |
+
|
| 113 |
+
``` cpp
|
| 114 |
+
template<class C> constexpr auto ssize(const C& c)
|
| 115 |
+
-> common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>;
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
*Effects:* Equivalent to:
|
| 119 |
+
|
| 120 |
+
``` cpp
|
| 121 |
+
return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(c.size())>>>(c.size());
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
``` cpp
|
| 125 |
+
template<class T, ptrdiff_t N> constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept;
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
*Returns:* `N`.
|
| 129 |
+
|
| 130 |
+
``` cpp
|
| 131 |
+
template<class C> [[nodiscard]] constexpr auto empty(const C& c) -> decltype(c.empty());
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
*Returns:* `c.empty()`.
|
| 135 |
+
|
| 136 |
+
``` cpp
|
| 137 |
+
template<class T, size_t N> [[nodiscard]] constexpr bool empty(const T (&array)[N]) noexcept;
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
*Returns:* `false`.
|
| 141 |
+
|
| 142 |
+
``` cpp
|
| 143 |
+
template<class E> [[nodiscard]] constexpr bool empty(initializer_list<E> il) noexcept;
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
*Returns:* `il.size() == 0`.
|
| 147 |
+
|
| 148 |
+
``` cpp
|
| 149 |
+
template<class C> constexpr auto data(C& c) -> decltype(c.data());
|
| 150 |
+
template<class C> constexpr auto data(const C& c) -> decltype(c.data());
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
*Returns:* `c.data()`.
|
| 154 |
+
|
| 155 |
+
``` cpp
|
| 156 |
+
template<class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
*Returns:* `array`.
|
| 160 |
+
|
| 161 |
+
``` cpp
|
| 162 |
+
template<class E> constexpr const E* data(initializer_list<E> il) noexcept;
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
*Returns:* `il.begin()`.
|
| 166 |
+
|
| 167 |
+
<!-- Link reference definitions -->
|
| 168 |
+
[alg.req]: #alg.req
|
| 169 |
+
[alg.req.general]: #alg.req.general
|
| 170 |
+
[alg.req.ind.cmp]: #alg.req.ind.cmp
|
| 171 |
+
[alg.req.ind.copy]: #alg.req.ind.copy
|
| 172 |
+
[alg.req.ind.move]: #alg.req.ind.move
|
| 173 |
+
[alg.req.ind.swap]: #alg.req.ind.swap
|
| 174 |
+
[alg.req.mergeable]: #alg.req.mergeable
|
| 175 |
+
[alg.req.permutable]: #alg.req.permutable
|
| 176 |
+
[alg.req.sortable]: #alg.req.sortable
|
| 177 |
+
[back.insert.iter.ops]: #back.insert.iter.ops
|
| 178 |
+
[back.insert.iterator]: #back.insert.iterator
|
| 179 |
+
[back.inserter]: #back.inserter
|
| 180 |
+
[basic.fundamental]: basic.md#basic.fundamental
|
| 181 |
+
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 182 |
+
[basic.lookup.unqual]: basic.md#basic.lookup.unqual
|
| 183 |
+
[basic.lval]: expr.md#basic.lval
|
| 184 |
+
[bidirectional.iterators]: #bidirectional.iterators
|
| 185 |
+
[bidirectionaliterator]: #bidirectionaliterator
|
| 186 |
+
[common.iter.access]: #common.iter.access
|
| 187 |
+
[common.iter.cmp]: #common.iter.cmp
|
| 188 |
+
[common.iter.const]: #common.iter.const
|
| 189 |
+
[common.iter.cust]: #common.iter.cust
|
| 190 |
+
[common.iter.nav]: #common.iter.nav
|
| 191 |
+
[common.iter.types]: #common.iter.types
|
| 192 |
+
[common.iterator]: #common.iterator
|
| 193 |
+
[concept.swappable]: concepts.md#concept.swappable
|
| 194 |
+
[concept.totallyordered]: concepts.md#concept.totallyordered
|
| 195 |
+
[concepts.object]: concepts.md#concepts.object
|
| 196 |
+
[containers]: containers.md#containers
|
| 197 |
+
[counted.iter.access]: #counted.iter.access
|
| 198 |
+
[counted.iter.cmp]: #counted.iter.cmp
|
| 199 |
+
[counted.iter.const]: #counted.iter.const
|
| 200 |
+
[counted.iter.cust]: #counted.iter.cust
|
| 201 |
+
[counted.iter.elem]: #counted.iter.elem
|
| 202 |
+
[counted.iter.nav]: #counted.iter.nav
|
| 203 |
+
[counted.iterator]: #counted.iterator
|
| 204 |
+
[cpp17.copyassignable]: #cpp17.copyassignable
|
| 205 |
+
[cpp17.equalitycomparable]: #cpp17.equalitycomparable
|
| 206 |
+
[customization.point.object]: library.md#customization.point.object
|
| 207 |
+
[default.sentinels]: #default.sentinels
|
| 208 |
+
[defns.projection]: library.md#defns.projection
|
| 209 |
+
[expr.call]: expr.md#expr.call
|
| 210 |
+
[expr.const]: expr.md#expr.const
|
| 211 |
+
[forward.iterators]: #forward.iterators
|
| 212 |
+
[forwarditerator]: #forwarditerator
|
| 213 |
+
[front.insert.iter.ops]: #front.insert.iter.ops
|
| 214 |
+
[front.insert.iterator]: #front.insert.iterator
|
| 215 |
+
[front.inserter]: #front.inserter
|
| 216 |
+
[func.def]: utilities.md#func.def
|
| 217 |
+
[incrementable.traits]: #incrementable.traits
|
| 218 |
+
[indirectcallable]: #indirectcallable
|
| 219 |
+
[indirectcallable.general]: #indirectcallable.general
|
| 220 |
+
[indirectcallable.indirectinvocable]: #indirectcallable.indirectinvocable
|
| 221 |
+
[input.iterators]: #input.iterators
|
| 222 |
+
[inputiterator]: #inputiterator
|
| 223 |
+
[insert.iter.ops]: #insert.iter.ops
|
| 224 |
+
[insert.iterator]: #insert.iterator
|
| 225 |
+
[insert.iterators]: #insert.iterators
|
| 226 |
+
[inserter]: #inserter
|
| 227 |
+
[iostream.format]: input.md#iostream.format
|
| 228 |
+
[istream.iterator]: #istream.iterator
|
| 229 |
+
[istream.iterator.cons]: #istream.iterator.cons
|
| 230 |
+
[istream.iterator.ops]: #istream.iterator.ops
|
| 231 |
+
[istreambuf.iterator]: #istreambuf.iterator
|
| 232 |
+
[istreambuf.iterator.cons]: #istreambuf.iterator.cons
|
| 233 |
+
[istreambuf.iterator.ops]: #istreambuf.iterator.ops
|
| 234 |
+
[istreambuf.iterator.proxy]: #istreambuf.iterator.proxy
|
| 235 |
+
[iterator]: #iterator
|
| 236 |
+
[iterator.assoc.types]: #iterator.assoc.types
|
| 237 |
+
[iterator.concept.bidir]: #iterator.concept.bidir
|
| 238 |
+
[iterator.concept.contiguous]: #iterator.concept.contiguous
|
| 239 |
+
[iterator.concept.forward]: #iterator.concept.forward
|
| 240 |
+
[iterator.concept.inc]: #iterator.concept.inc
|
| 241 |
+
[iterator.concept.input]: #iterator.concept.input
|
| 242 |
+
[iterator.concept.iterator]: #iterator.concept.iterator
|
| 243 |
+
[iterator.concept.output]: #iterator.concept.output
|
| 244 |
+
[iterator.concept.random.access]: #iterator.concept.random.access
|
| 245 |
+
[iterator.concept.readable]: #iterator.concept.readable
|
| 246 |
+
[iterator.concept.sentinel]: #iterator.concept.sentinel
|
| 247 |
+
[iterator.concept.sizedsentinel]: #iterator.concept.sizedsentinel
|
| 248 |
+
[iterator.concept.winc]: #iterator.concept.winc
|
| 249 |
+
[iterator.concept.writable]: #iterator.concept.writable
|
| 250 |
+
[iterator.concepts]: #iterator.concepts
|
| 251 |
+
[iterator.concepts.general]: #iterator.concepts.general
|
| 252 |
+
[iterator.cpp17]: #iterator.cpp17
|
| 253 |
+
[iterator.cust]: #iterator.cust
|
| 254 |
+
[iterator.cust.move]: #iterator.cust.move
|
| 255 |
+
[iterator.cust.swap]: #iterator.cust.swap
|
| 256 |
+
[iterator.iterators]: #iterator.iterators
|
| 257 |
+
[iterator.operations]: #iterator.operations
|
| 258 |
+
[iterator.primitives]: #iterator.primitives
|
| 259 |
+
[iterator.range]: #iterator.range
|
| 260 |
+
[iterator.requirements]: #iterator.requirements
|
| 261 |
+
[iterator.requirements.general]: #iterator.requirements.general
|
| 262 |
+
[iterator.synopsis]: #iterator.synopsis
|
| 263 |
+
[iterator.traits]: #iterator.traits
|
| 264 |
+
[iterators]: #iterators
|
| 265 |
+
[iterators.common]: #iterators.common
|
| 266 |
+
[iterators.counted]: #iterators.counted
|
| 267 |
+
[iterators.general]: #iterators.general
|
| 268 |
+
[iterators.relations]: #iterators.relations
|
| 269 |
+
[iterators.summary]: #iterators.summary
|
| 270 |
+
[lib.types.movedfrom]: library.md#lib.types.movedfrom
|
| 271 |
+
[move.iter.cons]: #move.iter.cons
|
| 272 |
+
[move.iter.elem]: #move.iter.elem
|
| 273 |
+
[move.iter.nav]: #move.iter.nav
|
| 274 |
+
[move.iter.nonmember]: #move.iter.nonmember
|
| 275 |
+
[move.iter.op.comp]: #move.iter.op.comp
|
| 276 |
+
[move.iter.op.conv]: #move.iter.op.conv
|
| 277 |
+
[move.iter.requirements]: #move.iter.requirements
|
| 278 |
+
[move.iterator]: #move.iterator
|
| 279 |
+
[move.iterators]: #move.iterators
|
| 280 |
+
[move.sent.ops]: #move.sent.ops
|
| 281 |
+
[move.sentinel]: #move.sentinel
|
| 282 |
+
[namespace.std]: library.md#namespace.std
|
| 283 |
+
[ostream.iterator]: #ostream.iterator
|
| 284 |
+
[ostream.iterator.cons.des]: #ostream.iterator.cons.des
|
| 285 |
+
[ostream.iterator.ops]: #ostream.iterator.ops
|
| 286 |
+
[ostreambuf.iter.cons]: #ostreambuf.iter.cons
|
| 287 |
+
[ostreambuf.iter.ops]: #ostreambuf.iter.ops
|
| 288 |
+
[ostreambuf.iterator]: #ostreambuf.iterator
|
| 289 |
+
[output.iterators]: #output.iterators
|
| 290 |
+
[outputiterator]: #outputiterator
|
| 291 |
+
[predef.iterators]: #predef.iterators
|
| 292 |
+
[projected]: #projected
|
| 293 |
+
[random.access.iterators]: #random.access.iterators
|
| 294 |
+
[randomaccessiterator]: #randomaccessiterator
|
| 295 |
+
[range.cmp]: utilities.md#range.cmp
|
| 296 |
+
[range.iter.op.advance]: #range.iter.op.advance
|
| 297 |
+
[range.iter.op.distance]: #range.iter.op.distance
|
| 298 |
+
[range.iter.op.next]: #range.iter.op.next
|
| 299 |
+
[range.iter.op.prev]: #range.iter.op.prev
|
| 300 |
+
[range.iter.ops]: #range.iter.ops
|
| 301 |
+
[ranges]: ranges.md#ranges
|
| 302 |
+
[readable.traits]: #readable.traits
|
| 303 |
+
[reverse.iter.cmp]: #reverse.iter.cmp
|
| 304 |
+
[reverse.iter.cons]: #reverse.iter.cons
|
| 305 |
+
[reverse.iter.conv]: #reverse.iter.conv
|
| 306 |
+
[reverse.iter.elem]: #reverse.iter.elem
|
| 307 |
+
[reverse.iter.nav]: #reverse.iter.nav
|
| 308 |
+
[reverse.iter.nonmember]: #reverse.iter.nonmember
|
| 309 |
+
[reverse.iter.requirements]: #reverse.iter.requirements
|
| 310 |
+
[reverse.iterator]: #reverse.iterator
|
| 311 |
+
[reverse.iterators]: #reverse.iterators
|
| 312 |
+
[std.iterator.tags]: #std.iterator.tags
|
| 313 |
+
[stream.buffers]: input.md#stream.buffers
|
| 314 |
+
[stream.iterators]: #stream.iterators
|
| 315 |
+
[swappable.requirements]: library.md#swappable.requirements
|
| 316 |
+
[temp.deduct]: temp.md#temp.deduct
|
| 317 |
+
[temp.func.order]: temp.md#temp.func.order
|
| 318 |
+
[temp.inst]: temp.md#temp.inst
|
| 319 |
+
[unreachable.sentinel]: #unreachable.sentinel
|
| 320 |
+
[unreachable.sentinels]: #unreachable.sentinels
|
| 321 |
+
[utility.arg.requirements]: library.md#utility.arg.requirements
|
| 322 |
+
|
| 323 |
+
[^1]: The sentinel denoting the end of a range may have the same type as
|
| 324 |
+
the iterator denoting the beginning of the range, or a different
|
| 325 |
+
type.
|
| 326 |
+
|
| 327 |
+
[^2]: This definition applies to pointers, since pointers are iterators.
|
| 328 |
+
The effect of dereferencing an iterator that has been invalidated is
|
| 329 |
+
undefined.
|