Boost logo

Boost Users :

Subject: Re: [Boost-users] Error (runtime) assigning multi_array to multi_array with smaller dimensions
From: Oei, YC (oei.yungchin_at_[hidden])
Date: 2009-05-21 21:00:32


Apologies all - was a bit too eagerly hitting send. So, quoting myself a bit:

>> //class cpp file
>> //at class constructor
>> array2d = boost::multi_array<char,2>(boost::extents[x][y]);
>
> I think the problem is that the last line quoted above is an
> assignment, not an initialisation:

Actually if this was really the problem, the assertions in the
assignment operator should cause the construction to fail. But the
failed assertion you sent (below) does suggest that array2d is for
some reason empty. So I'm a bit puzzled it gets that far?

> Reference boost::detail::multi_array::value_accessor_n<T,
> NumDims>::access(boost::type<Reference>, boost::multi_array_types::index,
> TPtr, const boost::multi_array_types::size_type*, const
> boost::multi_array_types::index*, const boost::multi_array_types::index*)
> const [with Reference = boost::detail::multi_array::sub_array<char, 1u>,
> TPtr = char*, T = char, unsigned int NumDims = 2u]: Assertion `size_type(idx
> - index_bases[0]) < extents[0]' failed.


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