tmp/tmp3kyzxg5p/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Sized ranges <a id="range.sized">[[range.sized]]</a>
|
| 2 |
+
|
| 3 |
+
The `sized_range` concept refines `range` with the requirement that the
|
| 4 |
+
number of elements in the range can be determined in amortized constant
|
| 5 |
+
time using `ranges::size`.
|
| 6 |
+
|
| 7 |
+
``` cpp
|
| 8 |
+
template<class T>
|
| 9 |
+
concept sized_range =
|
| 10 |
+
range<T> &&
|
| 11 |
+
requires(T& t) { ranges::size(t); };
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
Given an lvalue `t` of type `remove_reference_t<T>`, `T` models
|
| 15 |
+
`sized_range` only if
|
| 16 |
+
|
| 17 |
+
- `ranges::size(t)` is amortized 𝑂(1), does not modify `t`, and is equal
|
| 18 |
+
to `ranges::distance(t)`, and
|
| 19 |
+
- if `iterator_t<T>` models `forward_iterator`, `ranges::size(t)` is
|
| 20 |
+
well-defined regardless of the evaluation of `ranges::begin(t)`.
|
| 21 |
+
\[*Note 1*: `ranges::size(t)` is otherwise not required to be
|
| 22 |
+
well-defined after evaluating `ranges::begin(t)`. For example,
|
| 23 |
+
`ranges::size(t)` might be well-defined for a `sized_range` whose
|
| 24 |
+
iterator type does not model `forward_iterator` only if evaluated
|
| 25 |
+
before the first call to `ranges::begin(t)`. — *end note*]
|
| 26 |
+
|
| 27 |
+
``` cpp
|
| 28 |
+
template<class>
|
| 29 |
+
inline constexpr bool disable_sized_range = false;
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
*Remarks:* Pursuant to [[namespace.std]], users may specialize
|
| 33 |
+
`disable_sized_range` for cv-unqualified program-defined types. Such
|
| 34 |
+
specializations shall be usable in constant expressions [[expr.const]]
|
| 35 |
+
and have type `const bool`.
|
| 36 |
+
|
| 37 |
+
[*Note 1*: `disable_sized_range` allows use of range types with the
|
| 38 |
+
library that satisfy but do not in fact model
|
| 39 |
+
`sized_range`. — *end note*]
|
| 40 |
+
|