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.

3404. Finish removing subrange's conversions from pair-like

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

Priority: 0

View all other issues in [range.subrange].

View all issues with C++23 status.

Discussion:

Both LWG 3281(i) "Conversion from pair-like types to subrange is a silent semantic promotion" and LWG 3282(i) "subrange converting constructor should disallow derived to base conversions" removed subrange's hated implicit conversions from pair-like types. Notably, neither issue removed the two "iterator-sentinel-pair" deduction guides which target the removed constructors nor the exposition-only iterator-sentinel-pair concept itself, all of which are now useless.

[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 25.5.4 [range.subrange] as indicated:

    […]
    template<class T, class U, class V>
      concept pair-like-convertible-from = // exposition only
        !range<T> && pair-like<T> && constructible_from<T, U, V>;
    
    template<class T>
      concept iterator-sentinel-pair = // exposition only
        !range<T> && pair-like<T> &&
        sentinel_for<tuple_element_t<1, T>, tuple_element_t<0, T>>;
        
    […]
    
    template<iterator-sentinel-pair P>
      subrange(P) -> subrange<tuple_element_t<0, P>, tuple_element_t<1, P>>;
    
    template<iterator-sentinel-pair P>
      subrange(P, make-unsigned-like-t(iter_difference_t<tuple_element_t<0, P>>)) ->
        subrange<uple_element_t<0, P>, tuple_element_t<1, P>, subrange_kind::sized>;
    […]