我想初始化结构中的特定num向量
struct pgp
{
int cnt;
pgp():cnt(0){}
};
struct MyStruct
{
vector<pgp> tmop(5);
};
然后我得到
C++ std::vector<pgp> MyStruct::tmop(error-type)
尝试这个
struct pgp
{
int cnt;
pgp(){
cnt = 0;
}
};
struct MyStruct
{
MyStruct(): tmop(5) {}
vector<pgp> tmop;
};
int main()
{
MyStruct a;
//a.tmop.resize(5);
cout<<"tmop size = "<<a.tmop.size()<<endl;
return 0;
}