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

3915. Redundant paragraph about expression variations

Section: 26.4.2 [range.range] Status: WP Submitter: Johel Ernesto Guerrero Peña Opened: 2023-04-01 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [range.range].

View all issues with WP status.


Originally editorial issue Editorial issue #4431.

Expression variations kick in for "an expression that is non-modifying for some constant lvalue operand", but std::ranges::range's is an non-constant lvalue, so 26.4.2 [range.range] p2 is redundant.

I suppose that the change that clarified the template parameters' cv-qualification for purposes of equality-preservation and requiring additional variations happened concurrently with the change of std::ranges::range's operand from a forwarding reference to a non-constant lvalue reference.

[2023-05-24; Reflector poll]

Set status to Tentatively Ready after six votes in favour during reflector poll.

[2023-06-17 Approved at June 2023 meeting in Varna. Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4944.

  1. Modify 26.2 [ranges.syn] as indicated:

    -1- The range concept defines the requirements of a type that allows iteration over its elements by providing an iterator and sentinel that denote the elements of the range.

    template<class T>
      concept range =
        requires(T& t) {
          ranges::begin(t); // sometimes equality-preserving (see below)
    -2- The required expressions ranges::begin(t) and ranges::end(t) of the range concept do not require implicit expression variations (18.2 [concepts.equality]).

    -3- […]