Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
boost::scoped_ptr is a smart pointer that deletes the instance it points to when going out of scope.
boost::scoped_ptr is similar to std::unique_ptr (C++11) and std::auto_ptr (C++98, depreciated in C++11).
#include <boost/scoped_ptr.hpp> |
Boost smart pointers check for null themselves, so there is no need to check these to be inititialized. In the example below a member variable of a class is requested from an unitialized smart pointer. The program will abort and the runtime error will be shown.
#include <boost/scoped_ptr.hpp> |
A boost::scoped_ptr can be null, but will check itself for it:
#include <boost/scoped_ptr.hpp> |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.