I am trying to use an object pointer as a key for the boost unordered_map:
boost::unordered_map<MyObject*, real> mymap;
but when I try to access the value for a given key, it never finds it:
boost::unordered_map<MyObject*, real>::const_iterator it = mymap.find(&SomeObject); // it is always equal to mymap.end()
If I print the map contents, I can see the keys are in there:
key: 0x3739c60, value: 1
key: 0x4541970, value: 0.873346
...
If I replace boost::unordered_map with std::map it works OK.
What’s the problem?
Answering my own question…
I figured out using a newer version of boost works OK. Seems to be caused by a bug in boost version 1.42.