"vertigo" <ax***@wp.pl> wrote in message
news:ci**********@nemesis.news.tpi.pl...
Hello
i created map<myclass1*,myclass2*> object.
I have problem with find function. It only works when
myclass1* is string or int (it does not work for char* and myclass1*).
Is it normal or i have made mistake somewhere ?
How does find() compares objects ?
If the objects are pointers then it compares pointers, which is almost never
what you want to do.
Maybe i should have written some
compare() function ?
Yes or a comparison functor, either can work.
struct Comp
{
bool operator()(const myclass1* x, myclass1* y) const
{
// return true if x is less than y
}
};
map<myclass1*,myclass2*,Comp> my_map;
john