Home Forums Gamescan Chat42 About
* Login   * Register * FAQ    * Search
It is currently Thu 10-31-2024 7:05PM

All times are UTC - 6 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: c++ question
PostPosted: Sun 03-21-2004 1:26PM 
Offline
Sergeant
User avatar

Joined: Thu 09-04-2003 6:04AM
Posts: 31

Source: Kelly Hall
Could someone give me a once over on three dimensional vectors?
I need vectors because my array gets so big that it exceeds the stack size limit and I can't "delete" an element of an array. I am using a 3D array of long doubles, something like: 30x30x1000
Sample code would be great!
Thanks

_________________
WTF!


Top
 Profile E-mail  
Report this post    Reply with quote  
 Post subject:
PostPosted: Sun 03-21-2004 2:02PM 
Offline
Lieutenant

Joined: Thu 08-21-2003 10:35PM
Posts: 72
Location: Kelly D

Source: Kelly Hall
You mean something like:

Code:
std::vector< std::vector< std::vector<long double> > > vec;
vec.resize(depth);
for(int y = 0; y < depth; y++) {
   vec[y].resize(height);
   for(int x = 0; x < height; x++) {
      vec[y][x].resize(width);
   }
}

// output element at (i, j, k)
std::cout << vec[i][j][k] << std::endl;



Top
 Profile  
Report this post    Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 3 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 © 2000, 2002, 2005, 2007 phpBB Group