Friday, December 3, 2010

auto_ptr

auto_ptrs cannot be used with arrays.

auto_ptrs only have one contained pointer in them. The boost library has classes that work with arrays.

The following are Boost smart pointer class templates and their corresponding header files:
scoped_ptr <class T> <boost/scoped_ptr.hpp >
scoped_array <class T> <boost/scoped_array.hpp >
shared_ptr <class T> <boost/shared_ptr.hpp >
shared_array <class T> <boost/shared_array.hpp >
weak_ptr <class T> <boost/weak_ptr.hpp >
intrusive_ptr<class T> <boost/intrusive_ptr.hpp>

Reference: http://www.boost.org/libs/smart_ptr/smart_ptr.htm

No comments:

Post a Comment