[C++-sig] numeric array indexing

Paul Guse paul at mustagh.com
Thu Jul 5 20:07:11 CEST 2007


I'm looking for some advice on the most efficient way to index an n-dimensional numeric array.
If say I have a std::vector<int> that defines the index, what is the best technique to translate that to an index? I have been using a list and a tuple to do so, but with many iterations I believe I'm doing some unnecessary allocations.
For a 1d array - > array[i],
For a 2d array -> array [(make_tuple (i,j)]
For a 3d array -> array [(make_tuple (list)]

Any thoughts on how to be more efficient?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070705/f10fbb11/attachment.htm>


More information about the Cplusplus-sig mailing list