tmp/tmp5tt_0ion/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### `ranges::size` <a id="range.prim.size">[[range.prim.size]]</a>
|
| 2 |
+
|
| 3 |
+
The name `ranges::size` denotes a customization point object
|
| 4 |
+
[[customization.point.object]].
|
| 5 |
+
|
| 6 |
+
Given a subexpression `E` with type `T`, let `t` be an lvalue that
|
| 7 |
+
denotes the reified object for `E`. Then:
|
| 8 |
+
|
| 9 |
+
- If `T` is an array of unknown bound [[dcl.array]], `ranges::size(E)`
|
| 10 |
+
is ill-formed.
|
| 11 |
+
- Otherwise, if `T` is an array type, `ranges::size(E)` is
|
| 12 |
+
expression-equivalent to `decay-copy(extent_v<T>)`.
|
| 13 |
+
- Otherwise, if `disable_sized_range<remove_cv_t<T>>` [[range.sized]] is
|
| 14 |
+
`false` and `decay-copy(t.size())` is a valid expression of
|
| 15 |
+
integer-like type [[iterator.concept.winc]], `ranges::size(E)` is
|
| 16 |
+
expression-equivalent to `decay-copy(t.size())`.
|
| 17 |
+
- Otherwise, if `T` is a class or enumeration type,
|
| 18 |
+
`disable_sized_range<remove_cv_t<T>>` is `false` and
|
| 19 |
+
`decay-copy(size(t))` is a valid expression of integer-like type with
|
| 20 |
+
overload resolution performed in a context in which unqualified lookup
|
| 21 |
+
for `size` finds only the declarations
|
| 22 |
+
``` cpp
|
| 23 |
+
void size(auto&) = delete;
|
| 24 |
+
void size(const auto&) = delete;
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
then `ranges::size(E)` is expression-equivalent to
|
| 28 |
+
`decay-copy(size(t))` with overload resolution performed in the above
|
| 29 |
+
context.
|
| 30 |
+
- Otherwise, if `to-unsigned-like(ranges::end(t) - ranges::begin(t))`
|
| 31 |
+
[[ranges.syn]] is a valid expression and the types `I` and `S` of
|
| 32 |
+
`ranges::begin(t)` and `ranges::end(t)` (respectively) model both
|
| 33 |
+
`sized_sentinel_for<S, I>` [[iterator.concept.sizedsentinel]] and
|
| 34 |
+
`forward_iterator<I>`, then `ranges::size(E)` is expression-equivalent
|
| 35 |
+
to `to-unsigned-like(ranges::end(t) - ranges::begin(t))`.
|
| 36 |
+
- Otherwise, `ranges::size(E)` is ill-formed.
|
| 37 |
+
|
| 38 |
+
[*Note 1*: Diagnosable ill-formed cases above result in substitution
|
| 39 |
+
failure when `ranges::size(E)` appears in the immediate context of a
|
| 40 |
+
template instantiation. — *end note*]
|
| 41 |
+
|
| 42 |
+
[*Note 2*: Whenever `ranges::size(E)` is a valid expression, its type
|
| 43 |
+
is integer-like. — *end note*]
|
| 44 |
+
|