The
std::queue<T,Container>::back[
^] function accesses the back of the queue: the last element pushed onto it.
If you want the oldest element, you would need to use
std::queue<T,Container>::front[
^] instead (or pop it off).
If that isn't what is giving you difficulties, you will have to be a lot clearer about your problem!