我试图做到以下几点:不能使结构的载体在C++
struct Code
{
GF2X generator;
vector<GF2X> codeWords;
};
vector<Code> allCodes;
不过,我结束了这个错误:
error: template argument for 'template<class _Alloc> class std::allocator' uses local type 'main()::Code'|
我完全失去了作为这意味着什么。这也是我第一次用C++编程。
哦,所以这是一个本地类型,因为我宣布它在主?这看起来像这使得工程类似于java类,但没有成员函数。 – Teofrostus 2012-07-26 22:05:27
@Teofrostus:在C++中,'struct'与具有单一区别的类完全相同:默认访问说明符是公共的。也就是说,'struct's可以有成员函数,包括虚拟成员函数,继承或派生,有构造函数和析构函数...... – 2012-07-27 04:30:29