|
-
September 16th, 2005, 05:10 PM
#1
const vector<vector<int> > ??
I'd like to define a constant global integer array 3 x N (N is known at compile time, just not off the top of my head), but I'm shying away from using standard arrays, such as int[3][N], since you can drop off the edge of them when not careful. I'm thinking about using vector<vector<int> >, but I'm having some noobie trouble initializing it. Can anyone give me some pointers to how I might define a constant global vector and initialize it in, say, GlobalVariables.h file?
For starters, I've tried:
vector<int> tempvec;
tempvec.push_back( /*Number of integers*/ 1);
tempvec.push_back( /*Number of doubles*/ 0);
tempvec.push_back( /*Number of booleans*/ 0);
static const vector<int> NUMBERS_IN_STONE(tempvec);
. . . but that doesn't work, presumably because it's in an .h file.
I'd like to find something like:
static const vector<vector<int> > YeOlNeverChangingNumbers( ??initialization list?? ) and plop that into the .h file, but I can't find anything that works.
Is there a better strategy that I might take?
I'm basically looking for a constant global array with some border-patrol built in. Thanks guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|