Boost logo

Boost Users :

Subject: [Boost-users] Multi-array non-preserving resize?
From: lindleyf_at_[hidden]
Date: 2010-04-26 12:50:53


I'd like to use a multi_array<double, 2> inside a loop, but the dimensions may be different each time. Now, I could create a new one on each iteration, but I'd prefer to avoid the extra allocations/frees if I can. I also could create it outside the loop and use resize(), but that promises to preserve elements if possible, and that's extra copying I don't need (presumably; I'm assuming here that an underlying 1D memory layout is used, which means that preserving elements after the first row would require moving things around).

Is there any simple way to ask a multi_array to resize itself without preserving elements?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net