You need to take care of yourself somehow. For example:
struct Foo { Foo() : elements(1024 * 1024 * 1024) { c.reset(new char[elements]); } boost::scoped_array<char> c; int elements; };
Note that you must use the smart pointer container to manage dynamically allocated objects so that you do not have to manually manage their lifetimes. Here I demonstrated the use of scoped_array , which is a very useful container. You can also use shared_array or use shared_ptr with user deletion.
James McNellis
source share