c++ - 在 C++ 中声明队列

标签 c++ queue

我试图在 C++ 中声明一个队列:

#include <queue>
......
......
queue<Process> *readyQueue = new queue<Process>;
.......

但我一直收到这个错误

'queue' was not declared in this scope

我错过了什么?当然,我创建了 Process 结构,所以问题不存在。 有什么问题?

最佳答案

您缺少 namespace 规范。我想你想要标准功能。 使用:

 #include <queue>
 ......
 std::queue<Process> *readyQueue = new std::queue<Process>;

 #include <queue>
 using std::queue;
 ......
 queue<Process> *readyQueue = new queue<Process>;

关于c++ - 在 C++ 中声明队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19754593/

相关文章:

java - 队列不删除元素(使用链表)[java]

c++ - C 字符串函数的包装器类有问题吗?

c# - 关于 CoCreateInstance() 方法实现的问题

c++ - VS2010 中的 Windows 窗体应用程序无需 .NET?

c++ - 在 C++ 中读取二进制文件而不将整个文件缓冲到内存中

c++ - 删除临时指针时出现段错误

java - 后增量和预增量运算符是否比普通 "+"运算符更有效?

java - 使用 BlockingQueue 时 Runnable 不会停止

iphone - 当 ASINetworkQueue 完成所有请求时如何显示 UILocalNotification?

C 队列字符数组