I have a n-dimensional Boost.MultiArray I initialize as follows:
const int n=3, size=4; //# of dimensions and size of one dimension
boost::multi_array
From the Boost Multi-Array documentation, yes, you can initialize it one line:
typedef boost::multi_array array_type;
typedef array_type::index index;
array_type A(boost::extents[3][4][2]);
The typedefs are for readability, one can just as easily do for your example:
boost::multi_array arr(boost::extents[2][4]);