Opened 6 years ago

#12454 new Feature Requests

multi_array: operator= does not resize array

Reported by: martin.koerner@… Owned by: Ronald Garcia
Milestone: To Be Determined Component: multi_array
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

Hello,

the copy operator does not resize the array in contrast to the copy constructor, which does. That is a pitfall.

In case of a multi_array_ref the size cannot be changed, but for a multi_array it can and it also should change the size.

#include <boost/multi_array.hpp>

int main() {

boost::multi_array<double, 2> a(boost::extents[3][4]); boost::multi_array<double, 2> b = a; ok boost::multi_array<double, 2> c; has size [0][0] c = a; fails

return 0;

}

Change History (0)

Note: See TracTickets for help on using tickets.