Boost logo

Boost Users :

Subject: Re: [Boost-users] [MultiArray] How to create / handle a collection of multi-array with varying dimensions?
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2009-09-28 08:31:52


Oliver Fochler wrote:
> 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?

If you know N at compile why not using a fusion::vector of multi_array ?


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