我想創建一個類的向量,我只是設置,我不斷收到錯誤。任何人都可以給我一些建議嗎?這裏是我的相關代碼:C++不能創建用戶定義的類的向量
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*'"
您是否意外地在主要方法中定義了類? – Antimony 2013-04-28 04:11:57
@Antimony我不知道爲什麼這很重要。在我的main()方法中,我沒有定義類和向量的問題。 – WhozCraig 2013-04-28 04:14:31
http://ideone.com/5s5ZOe工作正常,所以我相信銻是正確的。 – GRAYgoose124 2013-04-28 04:14:31