Multi-array non-preserving resize?
I'd like to use a multi_array
On Apr 26, 9:50 am,
I'd like to use a multi_array
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?
maybe not what you want but,...
if you know an upper bound of the size just declare a big
multi_array
participants (2)
-
alfC
-
lindleyf@cox.net