Boost logo

Boost Users :

From: Ramón Casero Cañas (yg-boost-users_at_[hidden])
Date: 2003-01-10 13:13:32


Hi, I would like to dinamically create a multi_array. Something like

typedef boost::multi_array<bool, 2> BoolMatrix;
typedef boost::multi_array<bool, 2>::index indexBoolMatrix;
boost::array<BoolMatrix::index, 2> shape = {{ 5, 8 }};
BoolMatrix *A; // NO MEMORY ALLOCATED

...

A = new BoolMatrix(shape); // MEMORY ALLOCATED
A.assign(data,data+40); // ELEMENTS INITIALIZED

The compiler (gcc 2.95.4) says that this kind of things are wrong. Or
didn't I understand how the memory allocation in multi_array works?

Cheers,

Ramón.


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