Reply to topic  [ 2 posts ] 
C++ 2D vectors 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
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?

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Mon Aug 29, 2011 8:10 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
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]);

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Mon Aug 29, 2011 8:40 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.