Subject: [Boost-bugs] [Boost C++ Libraries] #12454: multi_array: operator= does not resize array
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-09-14 11:04:57
#12454: multi_array: operator= does not resize array
------------------------------+-------------------------
Reporter: martin.koerner@⦠| Owner: garcia
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: multi_array
Version: Boost 1.61.0 | Severity: Problem
Keywords: |
------------------------------+-------------------------
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;
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12454> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC