B
BCC
Ive been googling and reading through my books but I haven't figured out a
solution (much less an elegant one) to create a multidimensional array with
a runtime determined number of dimensions. I also checked out the
boost::multi_array.hpp, and Giovanni Bavistrelli's Array code. Neither of
these seem to allow dynamic array dimensions.
For example, the user selects a 2 dimensional array, I want to create:
MyObject** array = new MyObject[dim1_size][dim2_size];
And if they select a 4 dim array:
MyObject**** array = new
MyObject[dim1_size][dim2_size][dim3_size][dim4_size];
Besides using bigugly if statements, how do I do this?
Thanks,
Bryan
solution (much less an elegant one) to create a multidimensional array with
a runtime determined number of dimensions. I also checked out the
boost::multi_array.hpp, and Giovanni Bavistrelli's Array code. Neither of
these seem to allow dynamic array dimensions.
For example, the user selects a 2 dimensional array, I want to create:
MyObject** array = new MyObject[dim1_size][dim2_size];
And if they select a 4 dim array:
MyObject**** array = new
MyObject[dim1_size][dim2_size][dim3_size][dim4_size];
Besides using bigugly if statements, how do I do this?
Thanks,
Bryan