This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofResolved status.
Section: 23.2.7[associative.reqmts]Status:ResolvedSubmitter: Alisdair MeredithOpened: 2009-03-12Last modified: 2020-09-06
Priority:Not Prioritized
View otheractive issues in [associative.reqmts].
View all otherissues in [associative.reqmts].
View all issues withResolved status.
Discussion:
Addresses UK 239 [CD1]
It is not possible to take a move-only key out of an unorderedcontainer, such as (multi)set or(multi)map, or the new unordered containers.
Add belowa.erase(q),a.extract(q), with the following notation:
a.extract(q)>, Return typepair<key, iterator>Extracts the element pointed to byq and erases it from theset. Returns apair containing the value pointed to byq and aniterator pointing to the element immediatelyfollowingq prior to the element being erased. If no suchelement exists,returnsa.end().
[Summit:]
We look forward to a paper on this topic. We recommend no action until apaper is available. The paper would need to address exception safety.
[Post Summit Alisdair adds:]
Would
value_typebe a better return type thankey_type?
[2009-07 post-Frankfurt:]
Leave Open. Alisdair to contact Chris Jefferson about this.
[2009-09-20 Howard adds:]
See the 2009-09-19 comment of839(i) for an API whichaccomplishes this functionality and also addresses several other usecases which this proposal does not.
[2009-10 Santa Cruz:]
Mark as NAD Future. No consensus to make the change at this time.
Original resolution [SUPERSEDED]:
In 23.2.7[associative.reqmts] Table 85, add:
Table 85 -- Associative container requirements (in addition to container) Expression Return type Assertion/note
pre-/post-conditionComplexity a.erase(q)... ... ... a.extract(q)pair<key_type, iterator>Extracts the element pointed to by qand erases it from theset. Returns apaircontaining the value pointed to byqand aniteratorpointing to the element immediately followingqprior to the element beingerased. If no such element exists, returnsa.end().amortized constant In 23.2.8[unord.req] Table 87, add:
Table 87 -- Unordered associative container requirements (in addition to container) Expression Return type Assertion/note
pre-/post-conditionComplexity a.erase(q)... ... ... a.extract(q)pair<key_type, iterator>Extracts the element pointed to by qand erases it from theset. Returns apaircontaining the value pointed to byqand aniteratorpointing to the element immediately followingqprior to the element beingerased. If no such element exists, returnsa.end().amortized constant
[08-2016, Post-Chicago]
Move to Tentatively Resolved
Proposed resolution:
This functionality is provided byP0083R3