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

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

Section: 24.7.2.2.6 [span.elem] Status: New Submitter: Arthur O'Dwyer Opened: 2023-11-09 Last modified: 2023-11-18

Priority: Not Prioritized

View all issues with New status.

Discussion:

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

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

Proposed resolution:

This wording is relative to N4964.

  1. Modify 24.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_;.