Boost logo

Boost Users :

Subject: Re: [Boost-users] Manipulating boost::multi_array
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-11-30 00:21:56


On 11/29/11 19:46, Brian Davis wrote:
> Something else I noticed:
>
> array_type::array_view<3>::
> type row_2 = a_3d_array[ boost::indices[range(0,
> z_dim)][range(1,1)][range(0,0)] ];
>
> was perfectly acceptable from a boost::multi_array ... why? dimensions
> of zero thickness should not be allowed. That is the ranges range(1,1)
> and range(0,0) should not be allowed imho. Of course if I can enter the
> zeroth dimenson of infintesmal thickness then all would be good.
>

If a multi_array with 0 elements is not allowed, then a std::list<T>
with no elements should not be allowed. To be more concrete, imagine:

  multi_array<T,2> maT(extents[n1][n2];

The std::list counterpart would be:

  std::list<std::list> lT;

where lT.size()==n1, and for any 0<i<lT.size(), lT[i].size()=n2.
Now, the constraint that all the dimensions of maT must be >0 would mean
that in the counterpart lT, all the lT[i].size() would have to be
n2 and n2>0. Now why couldn't all the lT[i].size() be 0. That's
certainly possible. If it's possible for lT, why not for maT?

-regards,
Larry


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