Hi Craig,

Sorry for the delay in this reply.  Yes, for no good reason I did not supply a collection-based interface for resize.  I have implemented such an interface and checked it into CVS.  So the following should work (assuming that A is a 3-dimensional array):


    boost::array<int,3> new_extents = {{4,3,2}};
    A.resize(new_extents);


Let me know if this works for you.

ron


On Feb 20, 2006, at 4:42 AM, Craig Glasgow wrote:

Hi,

 

I'm trying to write serialization load and save methods for multi-array. For the load method I have a function with
the prototype:

 



template<class Archive, class T, std::size_t NumDims>

inline void load(Archive& ar, boost::multi_array<T, NumDims>& arr,
const unsigned int file_version) 

 

This function gets called when the array is serialized and should populate the multi-array arr. However this requires re-sizing arr which apparently can only be done using the extents construct e.g.  arr.resize(boost::extents[3][4][2]), but I want to be able to do this for an arbitray number of dims as with reshape.

 

Any idea how this can be done?

 

Regards

Craig_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users