Boost logo

Boost Users :

From: Paul (elegant_dice_at_[hidden])
Date: 2005-02-01 03:23:19


Brian Neal wrote:
> Hi, I need some help understanding when and why you
> would want to use intrusive_ptr. Does someone have an
> example? I didn't get much out of the current
> documentation for it. Thank you.

For the Coin library (an OpenInventor implementation).

// declare add-ref/rm-ref functions
inline void intrusive_ptr_add_ref( SoNode* n ) { n->ref(); }
inline void intrusive_ptr_release( SoNode* n ) { n->unref(); }

now:
       intrusive_ptr<SoGroup> root;
will perform like a shared_ptr, except it will do ref() and unref()
instead of deletes.

Very useful.

Paul


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net