Boost logo

Boost Users :

From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2007-01-16 09:54:37


Markus Werle <numerical.simulation <at> web.de> writes:

>
> Hi!
>
> IMHO the behaviour of operator= for multi_array is a little bit broken.

And: I cannot figure out from the docs how to prepare a multi_array for
assignment.

I tried:

#include <boost/multi_array.hpp>

int main()
{
        typedef boost::multi_array<double, 2> array_type;

        array_type m1(boost::extents[3][4]);

         array_type m2;
        
        boost::array<array_type::index, 2> dims =
                {{ m1.shape()[0], m1.shape()[1] }};

        m2.reshape(dims);
        m2 = m1;
}

which still gives me an assertion:
assertion "num_elements_ == std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>())" failed: file
"/cygdrive/d/FEV-Data/Sourcen/cpp/VC8/Common/DLLs/boost_1_33_1/
boost/multi_array/multi_array_ref.hpp",
line 163

Also:
m2.reshape(m1.shape()); fails to compile

Markus


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