I have 3 classes :
Event
wich is purely abstractArrive
wich derivate from eventLeave
wich also derivate from event
Event
is defined as follow :
class Event{
protected:
double time;
}
I need to store events into a queue and retrieve them in ascending order based on event time.
To do that I created a priority_queue like this :
priority_queue<Event*, vector<Event*>, greater<>>
Comparators have been defined for Event
based on time.
I push into this queue objects of type Arrive
and Leave
.
Everything works great except that the queue return object not based on the smallest time but on the smallest pointer address value.