Adding elements to a 2D vector (Vector of vectors) C++

So lets say i have the:

vector<vector<int> > temp;

so it'd just be an empty 2d vector and pretend it's filled with 0s so it'd look like:

0  0
0  0
0  0
0  0

and let's say I want to add something to that vector, like if I had:

int x = 3, y = 4;

I want to push these onto the vector so that it looks something like:

0  0
0  0
0  0
3  4

and I've tried: temp.push_back(x,y); but this isn't the correct syntax.



from Recent Questions - Stack Overflow https://ift.tt/2S7JzTQ
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation