[osg-users] Best usage of function: return ref_ptr or standard ptr?

2012-01-30 Thread Juan Herrera
Hi, I have a function which I want to return a group, with two alternatives: Code: osg::ref_ptr osg::Group returnGroup() { osg::ref_ptr osg::Group group = new osg::Group; ... return group; } Code: osg::Group * returnGroup() { osg::Group * group = new osg::Group; ... return group; }

Re: [osg-users] Best usage of function: return ref_ptr or standard ptr?

2012-01-30 Thread Kim Bale
Hi Juan, Returning a reference counted pointer is in general the safest thing to do as it ensures that the object will get deleted when it goes out of scope. A quick search of the osg-users will reveal a number of threads on the subject alternatively try the link below:

Re: [osg-users] Best usage of function: return ref_ptr or standard ptr?

2012-01-30 Thread Philipp Moeller
Juan Herrera juan...@gmail.com writes: Hi, I have a function which I want to return a group, with two alternatives: Code: osg::ref_ptr osg::Group returnGroup() { osg::ref_ptr osg::Group group = new osg::Group; ... return group; } Code: osg::Group * returnGroup() {