Hello:

If I have a 2d Vector and I want to convert it to a 2d Array what would be the best way to accomplish that. I know that I can go through a for loop to do it element by element but I would prefer to use the copy command... any suggestions...Lets say the array or vector is 8X10...


Thanks

Recommended Answers

All 3 Replies

Hello:

If I have a 2d Vector and I want to convert it to a 2d Array what would be the best way to accomplish that. I know that I can go through a for loop to do it element by element but I would prefer to use the copy command... any suggestions...Lets say the array or vector is 8X10...


Thanks

bump

A 2D vector's elements can already be accessed with the same notation as a 2D array (i.e.:

vector_2D [row_or_col][col_or_row]

To use the copy command for a 2d vector, you would have to copy each
row into the array, not efficient to make so many calls if a few for loops
would do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.