C++11’s new unique_ptr
is a “smart pointer” for managing dynamically allocated memory. When a unique_ptr
goes out of scope, its destructor automatically returns the managed memory to the free store. In Chapter 17, we introduce unique_ptr
and show how to use it to manage dynamically allocated objects or a dynamically allocated built-in arrays.