I see that you don't use the std namespace, which I think is good practice. But you must not forget to use the std:: then!
Code:
std::list<Event> ReadyList;
I'm really not sure if this will solve your problem, but thats the only fault I see. Except some bad programming practice.
Code:
// this is bad looking code:
if(event_1.get_arrival_time() > simulated_time)
simulated_time = event_1.get_arrival_time();
//either do this:
if(event_1.get_arrival_time() > simulated_time) simulated_time = event_1.get_arrival_time();
//or this: <- I prefer to do this.
if(event_1.get_arrival_time() > simulated_time){
simulated_time = event_1.get_arrival_time();
}
It's the same code only looks different. Why do this? Easier to read, you won't missinterpritate the statement. This is otherwise a common bug place, just because you read the statement the wrong way. Look at this:
[code]
Code:
// this time I add another thing to the if statement:
if(event_1.get_arrival_time() > simulated_time)
simulated_time = event_1.get_arrival_time();
simulated_time += TIME_CONSTANT;
//OPS! error because I wanted the time_constant to be added to the simulated time if the ifstatement was true. And this bug only because I forgot the braces in the first place. If they were there from the beginning I wouldn't have missed them.
Well you get the idea: get it right the first time.
Tip:
Also i'm not sure abou the stl-list, but generally there are different insert time for push_front and push_back function. If i'm not totally lost right now, the push_back is faster than the front version. Do i performance check on the two and see. It might as well be the pop_front - pop_back that differs in time.
Well enough ranting