I know that there's a standard library vector in C++. Is there a queue? An online search suggests there might be, but there's not much about it if there is one.
Edit: All right. Thanks a ton guys.
I know that there's a standard library vector in C++. Is there a queue? An online search suggests there might be, but there's not much about it if there is one.
Edit: All right. Thanks a ton guys.
Yes, there's std::queue
. Implemented as "adaptors", on top of an existing container (since it's basically just a specialization).
Yes there is, you could choose the underlying container easily also if you are interested:
#include <queue>
int main()
{
std::queue<int> myqueue;
myqueue.push(3);
int x = myqueue.front();
myqueue.pop(); // pop is void!
}
Also, you might find std::deque (double ended queue) useful, depending on what you need a queue for
Another good reference for the C++ standard libraries is http://www.cplusplus.com.
Specifically their reference section: http://www.cplusplus.com/reference/.
Here's their page for std::queue: http://www.cplusplus.com/reference/stl/queue/.