Other people who know more about this than me may tell me I am wrong, but here 
is a simple rule of thumb I have used.

If the pointer is going to be saved for later use (i.e. class member, static 
variable, etc.) then it needs a ref_ptr.  If you are just going to create a 
local variable, add it to another object, then let the local variable go out of 
scope, you can get away with a raw pointer.  But some people use a ref_ptr 
there too, just to be safe.

Paul


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent: Wed 4/9/2008 11:05 AM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] use of ref_ptr
 
I just started using OSG and have never used ref_ptr's before, though I've read 
the "A Short Introduction to the Basic Principles of the Open Scene Graph" and 
belive I understand the concept. But I wonder if you have any advice on the use 
of ref_ptr's on OSG objects, and If you use them in some standard way.

I recon all the objects that inherits from "Referenced" should use ref_ptr for 
safer memory alloction/deleting, but I guess it's just a subjective choice.

<<winmail.dat>>

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to