
On 03/10/2005 06:58 AM, Larry Evans wrote:
On 03/10/2005 01:31 AM, Erik Wien wrote: [snip] Anyway, why not a template:
template < typename T, typename Shape > class array { ... };
where Shape is a vector_c<unsigned, S1,S2,...,Sn>
I should have mentioned that vector_c<...> is an mpl template and I probably should have appended a ::type.
to create a rank n array with S1 is length (or dimension) of 1st axis, S2 the length of 2nd axis, ... ? The strides of such a "compile-time specified shape" array could also be calculated at compile time as shown in the test_partial_product function of fold_seq_test.cpp in fold_seq_test.zip in http://boost-sandbox.sourceforge.net/vault/.
I just uploaded another version which calculates the offset for a given fixed vector of indices and fixed shape for a hypothetical array. The test is in function test_array_index_offset in the aforementioned .zip file.