This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Tentatively NAD status.
viewable_range
Section: 99 [ranges.refinements], 25.7.2 [range.adaptor.object] Status: Tentatively NAD Submitter: Jiang An Opened: 2023-03-27 Last modified: 2023-06-01
Priority: Not Prioritized
View all issues with Tentatively NAD status.
Discussion:
After LWG 3724(i), views::all
is well-constrained for view types,
and the constraints are stronger than viewable_range
.
The difference is that given an expression such that decltype
gives R
,
when decay_t<R>
is a view type and the implicit conversion of R
to decay_t<R>
is forbidden, views::all
rejects the expression,
but viewable_range
may accept R
.
So I think we should remove the additional constraints on views::all_t
.
While viewable_range
is probably not introducing any additional constraint within the standard library,
I think it is still useful to express the constraints on views::all
,
so it should be slightly adjusted to match views::all
.
Furthermore, viewable_range
is currently used in 25.7.2 [range.adaptor.object],
but given P2378R3 relaxed the requirements for range adaptor closure objects,
I think we should also apply similar relaxation for range adaptor objects.
This should have no impact on standard range adaptor objects.
[2023-06-01; Reflector poll]
Set status to Tentatively NAD after three votes in favour during reflector poll.
"First change is pointless. Second change is a duplicate of 3896(i).
Range adaptors return a view over their first argument, so they need to
require it's a viewable_range
."
Proposed resolution:
This wording is relative to N4944.
Change the definition of views::all_t
in 25.2 [ranges.syn] as indicated:
template<
viewable_rangeclass R> using all_t = decltype(all(declval<R>())); // freestanding
Change the definition of viewable_range
in 25.4.5 [range.refinements] as indicated:
-6- The
viewable_range
concept specifies the requirements of arange
type that can be converted to a view safely.template<class T> concept viewable_range = range<T> && ((view<remove_cvref_t<T>> &&
constructible_from<remove_cvref_t<T>, T>convertible_to<T, remove_cvref_t<T>>) || (!view<remove_cvref_t<T>> && (is_lvalue_reference_v<T> || (movable<remove_reference_t<T>> && !is-initializer-list<T>))));
Change 25.7.2 [range.adaptor.object] as indicated:
-6- A range adaptor object is a customization point object (16.3.3.3.5 [customization.point.object]) that accepts a
as its first argument and returns a view.
viewable_rangerange[…]
-8- If a range adaptor object
adaptor
accepts more than one argument, then letrange
be an expression such thatdecltype((range))
models, let
viewable_rangerangeargs...
be arguments such thatadaptor(range, args...)
is a well-formed expression as specified in the rest of subclause 25.7 [range.adaptors], and letBoundArgs
be a pack that denotesdecay_t<decltype((args))>...
. The expressionadaptor(args...)
produces a range adaptor closure objectf
that is a perfect forwarding call wrapper (22.10.4 [func.require]) with the following properties: [...]