Created on 2019-02-19.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4861.
Add a new paragraph after paragraph 1 in [ranges.syn]:
[Drafting note: The following does not define an analog to-signed-like for to-unsigned-like since we don't need it at this time.]
-?- Also within this Clause, make-signed-like-t<X> for an integer-like type X denotes make_signed_t<X> if X is an integer type; otherwise, it denotes a corresponding unspecified signed-integer-like type of the same width as X.
Modify [range.prim.ssize] as indicated:
-1- The name ranges::ssize denotes a customization point object ([customization.point.object]).
The expression ranges::ssize(E) for a subexpression E of type T is expression-equivalent to:
(1.1) — If range_difference_t<T> has width less than ptrdiff_t, static_cast<ptrdiff_t>(ranges::size(E)).
(1.2) — Otherwise, static_cast<range_difference_t<T>>(ranges::size(E)).-?- Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E. If ranges::size(t) is ill-formed, ranges::ssize(E) is ill-formed. Otherwise let D be make-signed-like-t<decltype(ranges::size(t))>, or ptrdiff_t if it is wider than that type; ranges::ssize(E) is expression-equivalent to static_cast<D>(ranges::size(t)).
[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]
[ 2020-08-21; Issue processing telecon: Tentatively Ready ]
[ 2020-07-31 Casey provides updated wording ]
Per discussion on the reflector.[ 2020-07-22 Casey provides wording ]
Previous resolution [SUPERSEDED]:
This wording is relative to N4861.
Add a new paragraph after paragraph 1 in [ranges.syn]:
-?- Also within this clause, make-signed-like-t<X> for an integer-like type X denotes make_signed_t<X> if X is an integer type; otherwise, it denotes a corresponding unspecified signed-integer-like type of the same width as X.Modify [range.prim.ssize] as indicated:
-1- The name ranges::ssize denotes a customization point object ([customization.point.object]).
The expression ranges::ssize(E) for a subexpression E of type T is expression-equivalent to:
(1.1) — If range_difference_t<T> has width less than ptrdiff_t, static_cast<ptrdiff_t>(ranges::size(E)).
(1.2) — Otherwise, static_cast<range_difference_t<T>>(ranges::size(E)).-?- Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E. If ranges::size(t) is ill-formed, ranges::ssize(E) is ill-formed. Otherwise, let D be the wider of ptrdiff_t or decltype(ranges::size(t)); ranges::ssize(E) is expression-equivalent to static_cast<make-signed-like-t<D>>(ranges::size(t)).
[ 2020-03-11 Issue Prioritization ]
Priority to 2 after reflector discussion.
ranges::size(E) works with a non-range for which E.size() or size(E) is valid. But ranges::ssize(E) requires the type range_difference_t which requires ranges::begin(E) to be valid. This means there are types for which ranges::size(E) is valid but ranges::ssize(E) is not.
Casey's reaction to this is: I believe we want ranges::ssize to work with any argument that ranges::size accepts. That suggest to me that we're going to need make-signed-like-t<T> after all, so we can "Let E be an expression, and let D be the wider of ptrdiff_t or decltype(ranges::size(E)). Then ranges::ssize(E) is expression-equivalent to static_cast<make-signed-like-t<D>>(ranges::size(E))." Although this wording is still slightly icky since D isn't a valid type when ranges::size(E) isn't a valid expression, I think it's an improvement?History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 21:40:50 | admin | set | messages: + msg11560 |
2020-11-09 21:40:50 | admin | set | status: ready -> wp |
2020-08-21 20:28:46 | admin | set | messages: + msg11452 |
2020-08-21 20:28:46 | admin | set | status: new -> ready |
2020-08-01 03:51:09 | admin | set | messages: + msg11421 |
2020-07-22 04:17:37 | admin | set | messages: + msg11408 |
2020-07-22 04:17:37 | admin | set | messages: + msg11407 |
2020-03-11 18:56:33 | admin | set | messages: + msg11161 |
2019-02-19 00:00:00 | admin | create |