resize() in boost/multi_array.hpp
Hi,
I found what I think is a bug in boost/multi_array.hpp. Perhaps some
of you can explain what is wrong. Look at the code below. When
executed you get the following error:
multi_array_ref.hpp:487: failed assertion
`std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape())'
This is caused by the line
x.resize(extents[n+1][3]);
It seems to me that the code is correct and should work properly.
Curiously if one adds
x[i][j].resize(extents[0][0]);
before x.resize(extents[n+1][3]), the error message disappears.
I also added another piece of code at the end showing that if one replaces
multi_array< multi_array
AMDG Eric Darve wrote:
Hi,
I found what I think is a bug in boost/multi_array.hpp. Perhaps some of you can explain what is wrong. Look at the code below. When executed you get the following error: multi_array_ref.hpp:487: failed assertion `std::equal(other.shape(),other.shape()+this->num_dimensions(), this->shape())'
This is caused by the line x.resize(extents[n+1][3]);
This seems to be by design. Multiarray doesn't have normal assignment
semantics.
#include "boost/multi_array.hpp"
#include <vector>
using boost::multi_array;
using boost::extents;
using std::vector;
int main(void) {
multi_array
participants (2)
-
Eric Darve
-
Steven Watanabe