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

2207. basic_string::at should not have a Requires clause

Section: 27.4.3.6 [string.access] Status: C++14 Submitter: Nevin Liber Opened: 2012-10-26 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [string.access].

View all issues with C++14 status.

Discussion:

basic_string::at() has a wide contract and should not have a "Requires" clause on it.

[2013-01-17, Juan Soulie comments]

This issue would also apply to every member function of basic_string that throws out_of_range, and to some cases where a length_error can be thrown.

[2013-03-15 Issues Teleconference]

Moved to Review.

While this could simply move to Ready on inspection, there is concern that this will not be the only such case. Alisdair volunteers to review clause 21/23 for more of such issues for Bristol, and update the proposed resolution as necessary.

[2013-04-18, Bristol]

Proposed resolution:

This wording is relative to N3376.

  1. Remove 27.4.3.6 [string.access] p5:

    const_reference at(size_type pos) const;
    reference at(size_type pos);
    

    -5- Requires: pos < size()

    -6- Throws: out_of_range if pos >= size().

    -7- Returns: operator[](pos).