J
jagguy
I am a little confused with the basic concept of vector of pointers.
The vector is easy enough.
Say you want a vector of pointers to int. The integers are not created
outside the vector so all we get is this and it doesn't work
vector<int*> ones;
ones->push_back(7);
//this failed to *ones.push_back(7)
ones->push_back(8);
ones->push_back(3);
cout << ones[0] << endl; //just print 1 out
this fails from 2nd line
q)do vectors automaticall dynamically create the variables?
The vector is easy enough.
Say you want a vector of pointers to int. The integers are not created
outside the vector so all we get is this and it doesn't work
vector<int*> ones;
ones->push_back(7);
//this failed to *ones.push_back(7)
ones->push_back(8);
ones->push_back(3);
cout << ones[0] << endl; //just print 1 out
this fails from 2nd line
q)do vectors automaticall dynamically create the variables?