N3873: Improved insertion interface for unique-key maps -- Thomas Köppe

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3873

Date: 2014-01-20

Improved insertion interface for unique-key maps

by Thomas Köppe

Excerpt:

The existing interface of unique-keyed map containers (std::map, std::unordered_map) is slightly underspecified, which makes certain container mutations more complicated to write than necessary. This proposal is to add new specialized algorithms:

  • emplace_stable(): if the key already exists, does not insert and does not modify the arguments.
  • emplace_or_update(): inserts or updates the mapped element if the key already exists.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.