Mar 24, 2013 at 8:58pm UTC
Create a linked list, and access tail pointer as front if you add to head, or head pointer as front if you add to tail.
I don't know if your question meant something different though.
Last edited on Mar 24, 2013 at 8:59pm UTC
Mar 24, 2013 at 9:00pm UTC
There is no way to do it without using a linked list?
Mar 24, 2013 at 9:05pm UTC
A dynamic array should work too.
Mar 24, 2013 at 9:29pm UTC
Im still confused. You mean keep a parallel list to the queue and use that?
Mar 24, 2013 at 10:04pm UTC
Sorry, I did not realize you were already using the std::queue.
To access an element, use
lane1.front()->priority
Mar 24, 2013 at 10:07pm UTC
Ok, that makes sense. But I got this error on that code:
expression must have pointer type
Mar 24, 2013 at 10:11pm UTC
all you did, at least in the above code, is declare the queue. You must add things to it before you can access them.
Oh and if your queue is Customer then use . else Customer* then use ->
lane1[0].priority; //me thinks
Last edited on Mar 24, 2013 at 10:13pm UTC
Mar 24, 2013 at 10:14pm UTC
I think that works. I could have sworn I tried that originally but I mist have spelled something wrong. Thank you. Have a great day!