Pass vector of vectors, AND just one of its vectors to a function

I have a vector of vectors, aptly named 'verrr'.
In my function 'foo', I want to modify both verrr and verrr[n].

Is it possible to only pass verrr[n] to 'foo', and then modify other parts of verrr within 'foo'?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void foo (vector<int> &vector) {

return;
}

int main () {

vector<vector<int> > verrr(4, vector<int>(1));

//...

foo (verrr[n]);

return 0;
}
If you only pass one element of the vector to your function you can only modify that one element. If you want to have access to the whole vector you need to pass the whole vector.


Topic archived. No new replies allowed.