I have a queue:
queue<string> saves. I need to use it’s ability to remove elements from the front. Is there a way to get a specific element in the queue like the 5th one?
Neither saves.at(4) nor saves[4] works.
>Solution :
The entire point of a queue is you can only see and get the item, if any, waiting at the out end. Anything that allows you to see any other values in the queue is not a queue.
Wanting to see inside the queue suggests that you do not want a queue. Try a std::deque instead.