Initializing static vectors and nested vectors
Oct 6, 2011 at 12:01am Oct 6, 2011 at 12:01am UTC
Basically as the tittle says, how do you Initializing static vectors and nested vectors. I was doing something along the lines of
1 2 3 4 5 6 7 8
int CReadout::vector.resize( 10);
int CReadout::nested_vector.resize(20);
int main(){
///call function that use vectors
return 0;
}
Which is really not even close to being right. Any help would be appreciated.
Oct 6, 2011 at 6:20pm Oct 6, 2011 at 6:20pm UTC
Not sure I understand
if CReadout has a static vector member
1 2 3 4 5 6
class CReadout
{
private :
static vector<int > myvect;
...
};
then initialisation might be
vector<int > CReadout::myvect = vector<int >(10);
Oct 7, 2011 at 6:16pm Oct 7, 2011 at 6:16pm UTC
Yes you are correct CReadout has a static vector member, I tried your suggestion for the initialization and I get the "error 17 expected primary-expression before ';' token". Here's what i have:
1 2
vector<int > CReadout::vector= vector<int >;
vector< vector<int > > CReadout::nested_vector= vector< vector<int > >;
Topic archived. No new replies allowed.