I am looking at the multidimensional array library from boost, and I'm having trouble figuring out a way to declare a multi_array member in the header file with an undefined shape, like "A" in the example below:
Class.h
std::size_t nX;
std::size_t nY;
std::size_t nZ;
boost::multi_array<double, 3> A;
which is later instantiated to a certain size in the source file:
Class.c++
nX = 3
nY = 4
nZ = 2
A = boost::multi_array<double, 3>(boost::extents[nX][nY][nZ]);
but this gives me an unequal shape error. Is there any way to do what I am attempting?
Ultimately, I need a member container to store three-dimensional data of a to-be-determined-later size. This worked with boost::numeric::ublas::matrix
for two dimensions without a problem, but now I need something that will work for three dimensions.
Can anyone tell me how/if this is possible with the multi_array class, or inform me of another library that might work instead?