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.

2258. a.erase(q1, q2) unable to directly return q2

Section: 24.2.7 [associative.reqmts] Status: C++14 Submitter: Geoff Alexander Opened: 2013-05-11 Last modified: 2016-01-28

Priority: 0

View other active issues in [associative.reqmts].

View all other issues in [associative.reqmts].

View all issues with C++14 status.

Discussion:

Section 24.2.7 [associative.reqmts], Table 102, page 743 of the C++ 2011 Standard states that a.erase(q1, q2) returns q2. The problem is that a.erase(q1, q2) cannot directly return q2 as the return type, iterator, differs from that of q2, const_iterator.

[2013-09 Chicago (evening issues group)]

The wording looks good, but is worded slightly differently to how we say the same for sequence containers, and for unordered associative containers. We should apply consistent wording in all three cases.

Alisdair to provide the wording.

[2014-02-12 Issaquah meeting]

Move a Immediate.

Proposed resolution:

  1. In the specification of a.erase(q1, q2) in sub-clause 24.2.7 [associative.reqmts], Table 102 change as indicated:

    Table 102 — Associative container requirements (in addition to container) (continued)
    Expression Return type Assertion/note pre-/post-condition Complexity
    a.erase(q1, q2) iterator erases all the elements in the range [q1,q2). Returns q2 an iterator pointing to the element pointed to by q2 prior to any elements being erased. If no such element exists, a.end() is returned. log(a.size()) + N where N has the value distance(q1, q2).