Hi,
I noticed that after a resize the storage order is reset to the default value. This is apparent not only printing the contents (see attached test case) but also by inspecting strides() directly. Not only this breaks my program, but the only way to set the storage order is apparently in the constructor and therefore resize becomes de facto unusable for non default storage orders, so I don't even have a workaround. I couldn't find anything regarding this in the docs. I believe this is a serious bug. Can anyone advise?


Antonio
 


#include <boost/multi_array.hpp>
#include <iostream>

int main() {
  typedef boost::multi_array<double,3> array_type;
  int tiling_graph_storage_order[] = {2, 0, 1};
  bool tiling_graph_index_order[] = {true, true, true};
 
  array_type A(boost::extents[3][4][2],
           boost::general_storage_order<3>(tiling_graph_storage_order,
                           tiling_graph_index_order));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 2; k++) {
    A[i][j][k] = 100 * i + 10 * j + k + 10000;
      }
    }
  }
  for (int i = 0; i < A.num_elements(); i++) {
    std::cout << *(A.origin() + i) << std::endl;
  }
  A.resize(boost::extents[3][4][2]);
  std::cout << "After resize" << std::endl;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 2; k++) {
    std::cout <<    A[i][j][k] << std::endl;
      }
    }
  }
 
}