Wednesday, October 27, 2010

Resource Acquisition Is Initialization (RAII)

Resource Acquisition Is Initialization (RAII) is a technique to protect memory leaks and other kinds of resource leaks by wrapping construction of the memory/resource in an object that is automatically destroyed when it goes out of scope. auto_ptr<T> can be used to do this for dynamically allocated memory.

The header file used for auto_ptr<T> is <memory>.

Reference: http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization

No comments:

Post a Comment