Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

(C++) boost::shared_ptr

 

A type of smart pointer that can be copied safely and cheap, without copying the object pointed to. When the last boost::shared_ptr using an object goes out of scope, it will delete the object pointed to.

 

 

//Create a Widget

boost::shared_ptr<Widget> widget(new Widget);

 

//Use the widget

widget->DoSomething();

 

//Make another shared_ptr to the same widget.

boost::shared_ptr<Widget> sameWidget = widget;

 

 

External link

* Boost's page about boost::shared_ptr

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.