Boost logo

Boost Users :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2005-01-10 13:23:31

Hi Grant,

On Jan 10, 2005, at 12:44 PM, Grant Goodyear wrote:

> I'm currently working on a numerical project that uses boost.python,
> and
> since we already had boost as a dependency we've begun using
> boost/multi_array_ref to simplify multi-dimensional array handling in
> our code. I was rather surprised when the following code fragment spit
> out pages of errors when I tried to compile it:
> float* data = (float*) malloc(nx*ny*sizeof(float));
> [...]
> boost::multi_array_ref<float, 2>
> xy(data, boost::extents[nx][ny]);
> xy = 0.; // errors out here

Yes, multi_array_ref does not support assignment from one type like you
have there. You can assign between arrays that have the same
dimensions however.

> Looking through the docs I realized that operator= isn't even
> mentioned,
> so perhaps I shouldn't have been surprised. It is rather unfortunate,
> though, that such a statement isn't allowed. (Unless, of course, I'm
> doing something wrong, which is completely possible.) Is there any
> plan to add such functionality in the future, or would it make more
> sense for us to switch to a different library (blitz++ or something
> similar)?

What other functionality are you looking for?

Hope this Helps,


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at