Title
Enable CTAD for ref-view
Status
c++20
Section
[range.ref.view]
Submitter
Casey Carter

Created on 2018-12-09.00:00:00 last changed 46 months ago

Messages

Date: 2018-12-16.11:28:40

Proposed resolution:

This wording is relative to N4791.

  1. Modify the ref-view class synopsis in [ranges.view.ref] as follows:

    namespace std::ranges {
      template<Range R>
        requires is_object_v<R>
      class ref-view : public view_interface<ref-view<R>> {
        […]
      };
    
      template<class R>
        ref_view(R&) -> ref_view<R>;
    }
    
Date: 2018-12-16.00:00:00

[ 2018-12-16 Status to Tentatively Ready after six positive votes on the reflector. ]

Date: 2018-12-09.00:00:00

In the specification of view::all in [range.all], paragraph 2.2 states that view::all(E) is sometimes expression-equivalent to "ref-view{E} if that expression is well-formed". Unfortunately, the expression ref-view{E} is never well-formed: ref-view's only non-default constructor is a perfect-forwarding-ish constructor template that accepts only arguments that convert to lvalues of the ref-view's template argument type, and either do not convert to rvalues or have a better lvalue conversion (similar to the reference_wrapper converting constructor ([refwrap.const]) after issue 2993).

Presumably this breakage was not intentional, and we should add a deduction guide to enable class template argument deduction to function as intended by paragraph 2.2.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-02-26 17:40:23adminsetstatus: voting -> wp
2019-01-21 04:50:04adminsetstatus: ready -> voting
2018-12-16 11:28:40adminsetmessages: + msg10258
2018-12-16 11:28:40adminsetstatus: new -> ready
2018-12-10 00:23:29adminsetmessages: + msg10252
2018-12-09 00:00:00admincreate