From Jason Turner

[range.prim.size]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpcis9zrz9/{from.md → to.md} +11 -18
tmp/tmpcis9zrz9/{from.md → to.md} RENAMED
@@ -4,31 +4,24 @@ 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
 
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 [[term.array.type]],
10
+ `ranges::size(E)` is ill-formed.
11
  - Otherwise, if `T` is an array type, `ranges::size(E)` is
12
+ expression-equivalent to `auto(extent_v<T>)`.
13
  - Otherwise, if `disable_sized_range<remove_cv_t<T>>` [[range.sized]] is
14
+ `false` and `auto(t.size())` is a valid expression of integer-like
15
+ type [[iterator.concept.winc]], `ranges::size(E)` is
16
+ expression-equivalent to `auto({}t.size())`.
17
  - Otherwise, if `T` is a class or enumeration type,
18
+ `disable_sized_range<remove_cv_t<T>>` is `false` and `auto(size(t))`
19
+ is a valid expression of integer-like type where the meaning of `size`
20
+ is established as-if by performing argument-dependent lookup only
21
+ [[basic.lookup.argdep]], then `ranges::size(E)` is
22
+ expression-equivalent to that expression.
 
 
 
 
 
 
 
23
  - Otherwise, if `to-unsigned-like(ranges::end(t) - ranges::begin(t))`
24
  [[ranges.syn]] is a valid expression and the types `I` and `S` of
25
  `ranges::begin(t)` and `ranges::end(t)` (respectively) model both
26
  `sized_sentinel_for<S, I>` [[iterator.concept.sizedsentinel]] and
27
  `forward_iterator<I>`, then `ranges::size(E)` is expression-equivalent