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.

4011. "Effects: Equivalent to return" in [span.elem]

Section: 23.7.2.2.6 [span.elem] Status: WP Submitter: Arthur O'Dwyer Opened: 2023-11-09 Last modified: 2024-04-02

Priority: Not Prioritized

View all issues with WP status.

Discussion:

In reviewing the wording for P2821 span.at(), it had been noticed that 23.7.2.2.6 [span.elem] uses a lot of "Effects: Equivalent to return […];" which could be simply "Returns: […]".

For comparison, 27.3.3.6 [string.view.access] uses "Returns: ..." instead, so I suggest that 23.7.2.2.6 [span.elem] should be consistent with that.

[2024-03-11; Reflector poll]

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

[Tokyo 2024-03-23; Status changed: Voting → WP.]

Proposed resolution:

This wording is relative to N4964.

  1. Modify 23.7.2.2.6 [span.elem] as indicated:

    constexpr reference operator[](size_type idx) const;
    

    -1- Preconditions: idx < size() is true.

    -2- EffectsReturns: Equivalent to: return *(data() + idx);.

    -?- Throws: Nothing.

    constexpr reference front() const;
    

    -3- Preconditions: empty() is false.

    -4- EffectsReturns: Equivalent to: return *data();.

    -?- Throws: Nothing.

    constexpr reference back() const;
    

    -5- Preconditions: empty() is false.

    -6- EffectsReturns: Equivalent to: return *(data() + (size() - 1));.

    -?- Throws: Nothing.

    constexpr pointer data() const noexcept;
    

    -7- EffectsReturns: Equivalent to: return data_;.