Jan 18, 2020 at 11:59am
how declare initialize vector inside struct/class
1 2 3 4 5
|
struct Data {
int m=9;
vector<int> mydata(m);
}
|
gcc comes with
1 2
|
error: ‘m’ is not a type
| vector<int> mydata(m);
|
and
1 2 3
|
struct Data {
vector<int> mydata(m);
}
|
gcc comes with
1 2
|
error: expected identifier before numeric constant
25 | vector<int> mydata(9);
|
Last edited on Jan 18, 2020 at 12:03pm
Jan 18, 2020 at 1:12pm
So what exactly is a mydata()?