Boost logo

Boost Users :

Subject: [Boost-users] [SPAM:### 88%] Re: [multi_array] Create view at runtime
From: Ronald Garcia (garcia_at_[hidden])
Date: 2008-12-18 15:40:45


Hi Max,

I'm afraid that you cannot switch the number of dimensions of a view
at runtime, that's a property that is set at
compile-time. The best you can do is end up with one dimension of
size 1, i.e.
instead of:
[f ? range_t() : 11]

use

  [f ? range_t() : range_t(11)]

Cheers,
ron

On Dec 18, 2008, at 8:10 AM, loadcom wrote:

> Hello,
>
> I'm using boost::multi_array of boost 1_36_0 with VS2003SP1.
>
> I hope I could determine the number of dimensions of a view
> of a given multi_array at runtime, or something like this:
>
> typedef boost::multi_array<int, 5> array_t;
> typedef typename array_t::index_range range_t;
>
> array_t array;
> // ...
> bool f;
> array_t::array_view<_>::type view =
> grid[boost::indices[f? range_t() : 11]
> [f? range_t(1,2): range_t()][rang_t]];
>
> I'll be appreciated to have any kind of help.
>
> B/Rgds
> Max
>
> -------------------------------------------------------------------
> ÐÂÀ˿ռ䡪¡ªÓëÅóÓÑ¿ªÐÄ·ÖÏíÍøÂçÐÂÉú»î£¡
> (http://
> space.sina.com.cn/ )_______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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