I have a structure "Event", for which I have defined proper comparison operators. I now want to use a priority queue in STL to save the pointers of Event, as below:
The compiler reports the following error:
error C2923: 'std::priority_queue' : 'CompEventByPtr' is not a valid
template type argument for parameter '_Pr'
I tried another realization of CompEventByPtr:
bool CompEventByPtr(Event* pEvent1, Event* pEvent2)
{
return (pEvent1->time > pEvent2->time);
//Not using Event's comparison operator, but directly program it here
}
The same error happens...
Thanks very much for helping me with this problem!