//class header file boost::multi_array
array2d; //class cpp file //at class constructor array2d = boost::multi_array
(boost::extents[x][y]);
I think the problem is that the last line quoted above is an
assignment, not an initialisation: if you look in the boost headers,
you'll see the assignment operator is very different from the copy
constructor.
Basically if you have a constructor that first default-constructs
array2d, then you'll have an empty array. Then assigning to it, means
you are trying a deep-copy from a x-by-y array to a 0-by-0 array.
One way to fix it is to add a line:
//at class constructor
array2d.resize(boost::extents[x][y]);
array2d = boost::multi_array