Does C++ have standard queue?
I know th开发者_如何学Cat 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 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!
}
std::queue (container adaptor)
Yes, there's std::queue
. Implemented as "adaptors", on top of an existing container (since it's basically just a specialization).
std::priority_queue and std::queue
http://www.sgi.com/tech/stl/queue.html
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/.
Also, you might find std::deque (double ended queue) useful, depending on what you need a queue for
精彩评论