c++c++11boostboost-multi-array

How to std::move a boost::multi_array?


It doesn't appear that multi_array has a move constructor - is this correct? Is there a reason for this or was it just never implemented since the class seems to have been written before move semantics were available? Is there anything to be done about this in user land?


Solution

  • Boost.MultiArray does not support move construction (or move assignment). The only copy constructor is the one in line 229 in boost/multi_array.hpp.

      multi_array(const multi_array& rhs);
    

    (Among other reasons that's why I implemented my own multidimensional array library that supports move semantics: https://godbolt.org/z/M1bWGj8YW)