This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3405. common_view's converting constructor is bad, too

Section: 26.7.20.2 [range.common.view] Status: C++23 Submitter: Casey Carter Opened: 2020-02-20 Last modified: 2023-11-22

Priority: 0

View all other issues in [range.common.view].

View all issues with C++23 status.

Discussion:

LWG 3280 struck the problematic/extraneous converting constructor templates from the meow_view range adaptor types in the standard library with the exception of common_view. The omission of common_view seems to have been simply an oversight: its converting constructor template is no less problematic or extraneous. We should remove common_view's converting constructor template as well to finish the task. Both cmcstl2 and range-v3 removed the converting constructor template from common_view when removing the other converting constructor templates, so we have implementation experience that this change is good as well as consistent with the general thrust of LWG 3280.

[2020-03-11 Issue Prioritization]

Status set to Tentatively Ready after seven positive votes on the reflector.

[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4849.

  1. Modify 26.7.20.2 [range.common.view], class template common_view synopsis, as indicated:

      
      […]
      constexpr explicit common_view(V r);
      
      template<viewable_range R>
        requires (!common_range<R> && constructible_from<V, all_view<R>>)
      constexpr explicit common_view(R&& r);
      
      constexpr V base() const& requires copy_constructible<V> { return base_; }
      […]
      
    
    […]
    template<viewable_range R>
      requires (!common_range<R> && constructible_from<V, all_view<R>>)
    constexpr explicit common_view(R&& r);
    

    -2- Effects: Initializes base_ with views::all(std::forward<R>(r)).