hash_map.insert(value) doesn't overwrite??

  • ThirtyNineWinks

    ThirtyNineWinks - 2008-12-04

    The documentation for hash_map.insert(value_type) only mentions that it returns a pair<iterator,bool>, with the bool false when the key was already in the map.  It doesn't say what happens to the value in that case.  I expected that it would overwrite.  I was in for a big surprise and a lot of debugging to discover what the routine did.

    Perhaps this ought to be mentioned in the documentation.

    • Petr Ovtchenkov

      Petr Ovtchenkov - 2008-12-04

      What the reason to override object that has same key, i.e. _identical_ object? Looks like evident that it not override: just useless copy.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks