QT C++ DATA Structures
-
@ELIF
Then why not say so from the start?! So your question is not connected to Qt C++ datastricturesstructures after all. You can see the methods ofstd::queue
from the docs:The std::queue class is a container adaptor that gives the programmer the functionality of a queue - specifically, a FIFO (first-in, first-out) data structure.
The class template acts as a wrapper to the underlying container - only a specific set of functions is provided. The queue pushes the elements on the back of the underlying container and pops them from the front.
Accessors are
front()
andback()
It's a queue. So you cannot access middling elements, and why would you want to if you are choosing to use a queue?However, @JoeCFD's
std::dequeue
does allow access to middling elements. See Access c++ queue elements like an array for a discussion. -
@ELIF
Then why not say so from the start?! So your question is not connected to Qt C++ datastricturesstructures after all. You can see the methods ofstd::queue
from the docs:The std::queue class is a container adaptor that gives the programmer the functionality of a queue - specifically, a FIFO (first-in, first-out) data structure.
The class template acts as a wrapper to the underlying container - only a specific set of functions is provided. The queue pushes the elements on the back of the underlying container and pops them from the front.
Accessors are
front()
andback()
It's a queue. So you cannot access middling elements, and why would you want to if you are choosing to use a queue?However, @JoeCFD's
std::dequeue
does allow access to middling elements. See Access c++ queue elements like an array for a discussion.