I've a class 'Parent'
I declare a map using
map<Parent, Parent> mymap;
Now I derive one child 'Child'
and I've to add it to this map, so I do a static_cast like this:
Child* key = new Child();
Child* val = new Child();
mymap.insert(pair<Parent, Parent>(static_cast<Parent&>(*key), static_cast<Parent&>(*val)));
Now mymap shows correct count, but it doesn't find anything.
I search by creating another Child object and sending it as key like this:
Child key;
map<Parent, Parent>::iterator iter = mymap.find(key);
I've overloaded < operator for Parent class.
Every child object has a char* in it.
There is no copy-constructor defined for Parent class.
I need to know if mymap is storing objects then why they are not searchable.
This is urgently required, please help.
Thanks