Boost logo

Boost Users :

Subject: Re: [Boost-users] define multi dimension array at run time
From: Rhys Ulerich (rhys.ulerich_at_[hidden])
Date: 2012-06-08 17:54:57


Hi Moataz,

> So the array is defined as a class member but is first initialized through
> the constructor, but according to boost example page its something like:
> typedef boost::multi_array<double, 3> array_type;
>
> but I'd like:
> typedef boost::multi_array<std::vector<MyObject>, n> array_type;
> where n is given through the constructor
>
> Is this somehow possible?

You can't change the dimensionality of a multi_array at runtime.

You could write templated logic for N dimensional instances,
instantiate up to some maximum (say 42), and then manage those with
some common facade. This won't be pretty...

- Rhys


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