Я пытаюсь настроить очередь приоритетов для созданного мной класса, называемого Event. В 2 строках, прежде чем я попробую это, у меня есть еще 2 очереди очередей, которые, похоже, работают нормально, но я получаю сообщение об ошибке на третьем. Какие-либо предложения?C++ У меня возникли проблемы с настройкой очереди приоритетов созданного мной класса
class Event{
enum eventType { Arrival, CPUburstCompletion, IOcompletion, TimerExpired };
double time; // Defined as time units since the start of the simulation
};
vector<process> processTable;
int CPU;
int IO;
priority_queue< int, vector<int> > readyQueue;
priority_queue< int, vector<int> > IO_Queue;
priority_queue< Event, vector<Event> > eventQueue;
У меня не было функции компаратора в классе Event. Я поставил это, но я все еще получаю сообщение об ошибке. Не правильно ли я написал компаратор?
class Event{
enum eventType { Arrival, CPUburstCompletion, IOcompletion, TimerExpired };
double time; // Defined as time units since the start of the simulation
bool operator()(Event& e1, Event& e2){
if (e1.time < e2.time){
return true;
}
else{
return false;
}
}
};
vector<process> processTable;
int CPU;
int IO;
priority_queue< int, vector<int> > readyQueue;
priority_queue< int, vector<int> > IO_Queue;
priority_queue< Event, vector<Event> > eventQueue;
Какая ошибка вы получаете? –