I'm using the hash_map that comes with gcc 4.0 (i.e. <ext/hash_map>) and I have no idea why the destructor is being called on a key object.
I have a class object for which I've defined a hash function and a destructor. Then when I
the destructor is called on sc. I found this because my program would crash due to some_class::~some_class() being called twice. Since ~some_class() frees a dynamic member within, calling it twice will obviously cause a crash.
hash_map<sc, whatev, hash<sc> > hm;
hm[sc] = yadayada;
I went through the code of ext/hash_map and I couldn't find a place where a destructor would be called after hashing the key value. Does anyone have any ideas?