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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top