Does C++ have standard queue?

纵然是瞬间 提交于 2019-12-23 08:06:27

问题


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.


回答1:


std::queue (container adaptor)




回答2:


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!
}



回答3:


Yes, there's std::queue. Implemented as "adaptors", on top of an existing container (since it's basically just a specialization).




回答4:


std::priority_queue and std::queue




回答5:


http://www.sgi.com/tech/stl/queue.html




回答6:


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/.




回答7:


Also, you might find std::deque (double ended queue) useful, depending on what you need a queue for



来源:https://stackoverflow.com/questions/1519215/does-c-have-standard-queue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!