Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++20 status.

3173. Enable CTAD forref-view

Section: 25.7.6.2[range.ref.view]Status:C++20Submitter: Casey CarterOpened: 2018-12-09Last modified: 2021-06-06

Priority:0

View all issues withC++20 status.

Discussion:

In the specification ofview::all in 25.7.6[range.all],paragraph 2.2 states thatview::all(E) is sometimes expression-equivalent to"ref-view{E} if that expression is well-formed". Unfortunately,the expressionref-view{E} isnever well-formed:ref-view's only non-default constructor is aperfect-forwarding-ish constructor template that accepts only arguments thatconvert to lvalues of theref-view's template argument type, andeither do not convert to rvalues or have a better lvalue conversion (similar tothereference_wrapper converting constructor(22.10.6.2[refwrap.const]) after issue2993(i)).

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

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

Proposed resolution:

This wording is relative toN4791.

  1. Modify theref-view class synopsisin [ranges.view.ref] as follows:

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

[8]ページ先頭

©2009-2026 Movatter.jp