Question

How to free allocated memory for a Boost multi-array?

There is no clear, or free, or delete member function in its interface. I have a 3-dimensional array, and currently, I am doing resize to [0,0,0] extents to free up memory. But, is there a better way to free memory for my 3D array?

Was it helpful?

Solution

Resizing to zero extents sounds entirely satisfactory and reasonable.

After all, this is /also/ the only interface available to allocate the memory in the first place.

If you prefer, you could make a free function to do the jobs hiding the implementation detail.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top