Hi,

In my application I currently use std::map. However, I have found no way to solve the following problems: when an invalid key is passed to operator[] it inserts a new element into the map.

This is undesirable as my map is rather large to say the least (2-3GiB) in some instances, with 99% of the values being 0 (my map is std::map<std:air<int, int>, int>). Therefore big savings are to be had by assuming a default value of 0.

But, STL containers do not like being sub-classed and so implementing such functionality is not really possible.

Therefore, I am interested in alternatives which would support 'default values' for a key. Does anyone have any suggestions? (My application is currently just STL + Boost.)

Regards, Freddie.