I want to initialize a specific num vector in a struct,
struct pgp
{
int cnt;
pgp():cnt(0){}
};
struct MyStruct
{
vector<pgp> tmop(5);
};
then I get
C++ std::vector<pgp> MyStruct::tmop(error-type)
I want to initialize a specific num vector in a struct,
struct pgp
{
int cnt;
pgp():cnt(0){}
};
struct MyStruct
{
vector<pgp> tmop(5);
};
then I get
C++ std::vector<pgp> MyStruct::tmop(error-type)
try this
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;
}