我认为我在这里缺少一些基本的东西,但是我有一个我制作的称为“事件”的结构向量,称为 eventTable,我试图从函数中访问它。我收到此错误:“无效参数'候选人是:void push_back(const Event &)”有什么建议吗?
struct Event {
enum TYPE {
Arrival,
CPUBurstCompletion,
IOCompletion,
TimerExpired
};
double time;
TYPE type;
Event(Event::TYPE type, double time)
: type(type),
time(time) {}
};
vector<Event> eventTable;
void createEvent(Event::TYPE type, double time){
Event newEvent(Event::TYPE type, double time);
eventTable.push_back(newEvent);
}