C
Chris Roth
I'm just starting out using the algorithms in c++ std library.
I have a vector of vectors (v) and want to get a slice at some index.
ex. If v held two vectors, v1 and v2:
v1 = 1 2 3 4 5 6
v2 = 7 7 8 8 9 9
the slice at position 3 would be 3 8 (v1(3) and v2(3)).
I think it is possible to use transform to make the slice matrix, but
I'm having trouble with the final argument:
vector< vector<double> > v;
// populate v
vector<double> slice;
transform( v.begin(), v.end(), slice.begin(), ??? );
What goes in ???
I have tried std::vector<double>::at(), but it didn't work.
Thanks c++ board.
I have a vector of vectors (v) and want to get a slice at some index.
ex. If v held two vectors, v1 and v2:
v1 = 1 2 3 4 5 6
v2 = 7 7 8 8 9 9
the slice at position 3 would be 3 8 (v1(3) and v2(3)).
I think it is possible to use transform to make the slice matrix, but
I'm having trouble with the final argument:
vector< vector<double> > v;
// populate v
vector<double> slice;
transform( v.begin(), v.end(), slice.begin(), ??? );
What goes in ???
I have tried std::vector<double>::at(), but it didn't work.
Thanks c++ board.