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. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
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
participants (2)
-
Brian Neal
-
Paul