【发布时间】:2013-04-28 04:08:10
【问题描述】:
我正在尝试创建一个我刚刚设置的类的向量,但我不断收到错误。谁能给我一些建议?这是我的相关代码:
class process{
public:
enum state {New,Ready,Running,Waiting,IO,Terminated};
double CPUburst[MAXCPUBURSTS];
double IOburst[MAXCPUBURSTS-1];
int nCPUbursts; // The number of CPU bursts this process actually uses
int priority, type; // Not always used
int currentBurst; // Indicates which of the series of bursts is currently being handled
};
vector<process> processTable;
我得到的错误是:
"template argument for 'template<class _Alloc> class std::allocator' uses local type 'main(int,
char**)::process*'"
【问题讨论】:
-
您是否不小心在 main 方法中定义了类?
-
@Antimony 我不知道这有什么关系。在我的
main()方法中定义类和向量都没有问题。 -
ideone.com/5s5ZOe 工作正常,所以我相信锑是正确的。
-
我确实在 main 方法中定义了它。似乎解决了我的问题。谢谢!