I have a question on how pointers to a custom object are handled when used as Keys in an map. More specifically if I define
std::map< CustomClass*, int > foo;
The default implementation will compare the addresses stored by the pointers, so different objects will be considered as different keys. However, the logical state of the object will not be considered. For example, if you use
std::string * as the key, two different
std::string objects with the same text of
"Hello" would be considered a different key! (When stored in the map by their addresses)
It's ok to use pointers as keys so long as you understand the important difference above.