x404.co.uk
http://www.x404.co.uk/forum/

C++ 2D vectors
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=14600
Page 1 of 1

Author:  Fogmeister [ Mon Aug 29, 2011 8:10 pm ]
Post subject:  C++ 2D vectors

OK, changed the question now.

I can build a 2D array quite easily...

int grid[2][2] = {{1,2},{3,4}};

That does everything for me.

Is there a similar thing available for vectors?

Author:  Fogmeister [ Mon Aug 29, 2011 8:40 pm ]
Post subject:  Re: C++ 2D vectors

OK, done it :D

You have to use an array to begin with but...

Code:
int array1[9] = {2,0,0,0,8,0,3,0,0};
vector<int> vector1(&array1[0], &array[9]);

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/