Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofResolved status.

1041. Add associative/unordered container functions that allow to extract elements

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:]

Wouldvalue_type be 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)
ExpressionReturn typeAssertion/note
pre-/post-condition
Complexity
a.erase(q).........
a.extract(q)pair<key_type, iterator>Extracts the element pointed to byq and erases it from theset. Returns apair containing the value pointed to byq and aniteratorpointing to the element immediately followingq prior 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)
ExpressionReturn typeAssertion/note
pre-/post-condition
Complexity
a.erase(q).........
a.extract(q)pair<key_type, iterator>Extracts the element pointed to byq and erases it from theset. Returns apair containing the value pointed to byq and aniteratorpointing to the element immediately followingq prior 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


[8]ページ先頭

©2009-2026 Movatter.jp