C++:为什么我不能创建结构的队列?
C++: why can't i make a queue of a struct?
我有以下代码:
#include <queue>
struct Job
{
};
queue<Job> _jobQueue;
但我得到了错误:
error: ISO C++ forbids declaration of âqueueâ with no type
如何为结构创建队列?
您没有#include <queue>
。
编辑:编辑后,您需要将其限定为std::queue<Job>
。
尝试以下
std::queue<Job> _jobQueue;
相关文章:
- C++ 中优先级队列的结构排序条件
- 优先级经常更改的作业优先级队列的数据结构
- C++ 数据结构队列:使用 for 循环查找队列中最大的元素
- 从 STL 优先级队列C++ (QtCreator) 打印结构
- C 在标题文件中创建具有结构定义的结构的队列
- 在 stl 中迭代结构类型的队列
- 从指针队列访问结构的成员
- 使用提升库在队列和堆栈数据结构上保存和加载数据时出错
- 优先队列中的结构比较
- C 单例结构队列
- 我的字符串队列结构有什么问题?
- 结构类似优先级队列,但具有类似下界的内容
- 使用队列<结构时出现 SIGSEGV 错误 *>
- 工作线程队列的这种变体是某种模式或通用结构吗?
- 排序结构的队列
- 在队列中推动结构变量
- 指针指向结构的指针(优先队列)
- 尝试使用自定义类的结构中的变量创建该类的优先级队列
- 哪种数据结构最适合C++中的基本堆栈和队列
- 将包含指向该类型队列的指针的结构推送到队列上时发生运行时崩溃