tmp/tmpbdy9cgxb/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Approximately sized ranges <a id="range.approximately.sized">[[range.approximately.sized]]</a>
|
| 2 |
+
|
| 3 |
+
The `approximately_sized_range` concept refines `range` with the
|
| 4 |
+
requirement that an approximation of the number of elements in the range
|
| 5 |
+
can be determined in amortized constant time using
|
| 6 |
+
`ranges::reserve_hint`.
|
| 7 |
+
|
| 8 |
+
``` cpp
|
| 9 |
+
template<class T>
|
| 10 |
+
concept approximately_sized_range =
|
| 11 |
+
range<T> && requires(T& t) { ranges::reserve_hint(t); };
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
Given an lvalue `t` of type `remove_reference_t<T>`, `T` models
|
| 15 |
+
`approximately_sized_range` only if
|
| 16 |
+
|
| 17 |
+
- `ranges::reserve_hint(t)` is amortized 𝑂(1), does not modify `t`, and
|
| 18 |
+
has a value that is not negative and is representable in
|
| 19 |
+
`range_difference_t<T>`, and
|
| 20 |
+
- if `iterator_t<T>` models `forward_iterator`,
|
| 21 |
+
`ranges::reserve_hint(t)` is well-defined regardless of the evaluation
|
| 22 |
+
of `ranges::begin(t)`. \[*Note 1*: `ranges::reserve_hint(t)` is
|
| 23 |
+
otherwise not required to be well-defined after evaluating
|
| 24 |
+
`ranges::begin(t)`. For example, it is possible for
|
| 25 |
+
`ranges::reserve_hint(t)` to be well-defined for an whose iterator
|
| 26 |
+
type does not model `forward_iterator` only if evaluated before the
|
| 27 |
+
first call to `ranges::begin(t)`. — *end note*]
|
| 28 |
+
|