Boost logo

Boost Users :

Subject: [Boost-users] [MultiArray] How to create / handle a collection of multi-array with varying dimensions?
From: Oliver Fochler (janitor048_at_[hidden])
Date: 2009-09-28 07:43:33


Hi,

I'm trying to write some dimension independent routine that makes use of
Boost.MultiArray containers. The thing is that I would need several such
MultiArrays within this routine with the number of MultiArrays depending on
the overall number of dimensions.
And here is where it becomes complicated (at least for me). Let N be the
overall number of dimensions the routine works with. Then I would a
collection of N MultiArrays - but not with fixed dimensions but rather with
varying (internal) dimension. That is, a collection like this:

boost::multi_array<int, N> A
boost::multi_array<int, N-1> B
boost::multi_array<int, N-2> C
...

However, since N may vary when the routine is called I cannot hardcode the
array as above. I was thinking of a vector of multi_array or something like
that. But then I don't know how to treat the second template parameter in
defining the type of the vector (array, ...).

Is there a simple and efficient way to do this?

Cheers,
Oliver



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net