samedi 5 décembre 2015

c++11 std map add or replace and get the cuurent with a single lookup

c++11 added several improvements to the containers that eliminate double lookups or move operations.

It seems to me that adding or replacing a current item should be one of these common operations, but I am failing to implement it with a single lookup and without pointless construction.

Emplace seems inspired from sets where the key is the value, but in maps we often would like to replace the value associated with a key.

Am I missing something.

Aucun commentaire:

Enregistrer un commentaire