jeudi 8 janvier 2015

Why is there no [] operator for std::multimap?

Why is there no [] operator for std::multimap?


In errors with multimap (key type is std::string), people say "it makes no sense to extract elements out of it -- there are multiple values per each index". To me, it makes perfect sense and this is why there is equal_range.


So, why did they decided not to add a [] operator for multimap then?


I feel it is because things like myMultiMap[key] = value would be complex to handle but I am really not sure about that.


Aucun commentaire:

Enregistrer un commentaire