Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::multi_array equivalent for runtime number of dimensions
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-01-07 14:15:31


On Thu, Jan 7, 2010 at 11:48 AM, alfC <alfredo.correa_at_[hidden]> wrote:
>> I only know at runtime the dimension and extends of a multidimensional
>> array, though the number of dimensions is always < 10 for e.g.
>>
>> Is there a container that allows this?
>
> OvermindDL1 proposed to use boost.variant in thread called "question
> about multi_array use" (see there for a more complete code).
> for example:
> typedef boost::variant
>                <multi_array<int, 2>
>                ,multi_array<int, 3>
>                ,multi_array<int, 4>
>                ,multi_array<int, 5>
>                ,multi_array<int, 6>
>                ,multi_array<int, 7>
>                ,multi_array<int, 8>
>                > multi_array_variant_t;
>
> and he says that using boost.fusion will be even better. I didn't try
> it, but I would like to know if the solution really works well.

I have been using Boost.Fusion, I cannot recommend it enough, I have
completely decoupled the sizes of things from what operates on them.


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