M
mlt
I get an error out of range with the below code:
std::vector<std::vector<int>> vec;
vec[0][0] = 34;
why?
std::vector<std::vector<int>> vec;
vec[0][0] = 34;
why?
I get an error out of range with the below code:
std::vector<std::vector<int>> vec;
vec[0][0] = 34;
why?
std::vector<std::vector<int>> vec; //wrong syntacticallyI get an error out of range with the below code:
std::vector<std::vector<int>> vec;
vec[0][0] = 34;
why?
Victor Bazarov said:mlt said:I get an error out of range with the below code:
std::vector<std::vector<int>> vec;
What's the size of this vector? How many elements does it contain?
vec[0][0] = 34;
why?
Because you're out of range...
V
It does??? What compiler are you using?mlt said:This seems to solve the problem:
std::vector<std:.vector<int>> vec(1)(1);
vec[0][0] = 34;
Noah Roberts said:It does??? What compiler are you using?mlt said:This seems to solve the problem:
std::vector<std:.vector<int>> vec(1)(1);
vec[0][0] = 34;
mlt said:Noah Roberts said:It does??? What compiler are you using?mlt said:This seems to solve the problem:
std::vector<std:.vector<int>> vec(1)(1);
vec[0][0] = 34;
Visual studio on Vista 64
This seems to solve the problem:
std::vector<std:.vector<int>> vec(1)(1);
Reetesh said:std::vector<std::vector<int>> vec; //wrong syntacticallyI get an error out of range with the below code:
std::vector<std::vector<int>> vec;
vec[0][0] = 34;
why?
std::vector<std::vector<int> > vec; //correct syntactically
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.