It is not only the copy constructor - actually all constructors of boost::multiarray
will call allocate_space()
, which in turns invokes std::uninitialize_fill_n(base, allocated_elements_, T());
. Therefore a constructor without argument is required here. I don't think there is a way to bypass it if you still want to use boost::multi_array
. (I am referring to the source code of boost-1.46.0
.)
An alternative may be like this: you allocate and initialize space by yourself. Then pass the address to boost::multi_array_ref
. In this case you will have to manage the memory.