|
-
May 29th, 2009, 08:00 AM
#1
how to implement c++ table lookup?
I have a two dimensional array for a table lookup in some old C code. What would be the nicer c++ way?
I may be totally off, but I was thinking of using a
Code:
std::map<std::pair<int,int>,int>
But how would I initialize the constant table so its done only once?
I could use arrays again, but the indexes aren't ordered. For example, the table looks like: array[0][0] = 1; Then the next valid value is: array[0][8] =3. In other words array[0][1-7] are unused.
Last edited by sdcode; May 29th, 2009 at 08:44 AM.
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
|