Title
DR 704 removes complexity guarantee for clear()
Status
c++14
Section
[sequence.reqmts]
Submitter
Jonathan Wakely

Created on 2013-01-09.00:00:00 last changed 130 months ago

Messages

Date: 2013-04-19.22:36:19

Proposed resolution:

This wording is relative to N3485.

  1. Change Table 100 as indicated:

    Table 100 — Sequence container requirements (in addition to container) (continued)
    Expression Return type Assertion/note pre-/post-condition
    a.clear() void Destroys all elements in a. Invalidates all
    references, pointers, and iterators referring to
    the elements of a and may invalidate the
    past-the-end iterator.
    post: a.empty() returns true
    complexity: linear
Date: 2013-04-20.00:00:00

[ 2013-04-20 Bristol ]

Date: 2013-03-15.00:00:00

[ 2013-03-15 Issues Teleconference ]

Moved to Tentatively Ready.

Date: 2013-01-12.12:26:38

From the question at stackoverflow.

Were we aware that the resolution to LWG 704 means there is no complexity guarantee for clear() on most sequence containers? Previously it was implied by defining it in terms of erase(begin(), end()) but we no longer do that.

There are explicit complexity requirements for std::list::clear(), but not the other sequence containers.

Daniel:

The idea was that the notion of "destroys all elements in a" would imply a linear complexity, but the wording needs to be clearer, because this doesn't say that this step is the actual complexity bound.

History
Date User Action Args
2014-02-20 13:20:35adminsetstatus: wp -> c++14
2013-04-25 19:07:07adminsetstatus: voting -> wp
2013-04-19 22:36:19adminsetmessages: + msg6491
2013-04-19 22:36:19adminsetstatus: ready -> voting
2013-03-18 14:33:00adminsetmessages: + msg6439
2013-03-18 13:02:36adminsetstatus: new -> ready
2013-01-11 22:53:36adminsetmessages: + msg6314
2013-01-09 00:00:00admincreate