Title
Add associative/unordered container functions that allow to extract elements
Status
resolved
Section
[associative.reqmts]
Submitter
Alisdair Meredith

Created on 2009-03-12.00:00:00 last changed 93 months ago

Messages

Date: 2016-08-08.15:33:15

Proposed resolution:

This functionality is provided by P0083R3

Date: 2016-08-08.15:33:15

[ 08-2016, Post-Chicago ]

Move to Tentatively Resolved

Date: 2016-08-08.15:33:15

[ 2009-10 Santa Cruz: ]

Mark as NAD Future. No consensus to make the change at this time.

Original resolution [SUPERSEDED]:

In [associative.reqmts] Table 85, add:

Table 85 -- Associative container requirements (in addition to container)
Expression Return type Assertion/note
pre-/post-condition
Complexity
a.erase(q) ... ... ...
a.extract(q) pair<key_type, iterator> Extracts the element pointed to by q and erases it from the set. Returns a pair containing the value pointed to by q and an iterator pointing to the element immediately following q prior to the element being erased. If no such element exists, returns a.end(). amortized constant

In [unord.req] Table 87, add:

Table 87 -- Unordered associative container requirements (in addition to container)
Expression Return type Assertion/note
pre-/post-condition
Complexity
a.erase(q) ... ... ...
a.extract(q) pair<key_type, iterator> Extracts the element pointed to by q and erases it from the set. Returns a pair containing the value pointed to by q and an iterator pointing to the element immediately following q prior to the element being erased. If no such element exists, returns a.end(). amortized constant
Date: 2009-09-20.00:00:00

[ 2009-09-20 Howard adds: ]

See the 2009-09-19 comment of 839 for an API which accomplishes this functionality and also addresses several other use cases which this proposal does not.

Date: 2010-10-21.18:28:33

[ 2009-07 post-Frankfurt: ]

Leave Open. Alisdair to contact Chris Jefferson about this.

Date: 2010-10-21.18:28:33

[ Post Summit Alisdair adds: ]

Would value_type be a better return type than key_type?

Date: 2010-10-21.18:28:33

[ Summit: ]

We look forward to a paper on this topic. We recommend no action until a paper is available. The paper would need to address exception safety.

Date: 2012-10-21.13:19:07

Addresses UK 239 [CD1]

It is not possible to take a move-only key out of an unordered container, such as (multi)set or (multi)map, or the new unordered containers.

Add below a.erase(q), a.extract(q), with the following notation:

a.extract(q)>, Return type pair<key, iterator> Extracts the element pointed to by q and erases it from the set. Returns a pair containing the value pointed to by q and an iterator pointing to the element immediately following q prior to the element being erased. If no such element exists,returns a.end().

History
Date User Action Args
2016-08-08 15:33:15adminsetmessages: + msg8461
2016-08-08 15:33:15adminsetstatus: lewg -> resolved
2014-11-24 15:11:58adminsetstatus: nad future -> lewg
2010-10-21 18:28:33adminsetmessages: + msg449
2010-10-21 18:28:33adminsetmessages: + msg448
2010-10-21 18:28:33adminsetmessages: + msg447
2010-10-21 18:28:33adminsetmessages: + msg446
2010-10-21 18:28:33adminsetmessages: + msg445
2010-10-21 18:28:33adminsetmessages: + msg444
2009-03-12 00:00:00admincreate