Hi,
I was looking at Don Burns text from 2003 about reference pointers in osg
(sadly no longer available online, although it can be found via Internet
Archive sites.) But this got me thinking about the suggested pattern for
returning pointers from methods.
Looking through different parts of the osg source code you can find two
different patterns for returning pointers of object whose class inherits from
osg::Referenced.
Pattern 1:
Code:
osg::ref_ptr< osg::Node> createObject()
{
osg::ref_ptr< osg::Node > objectPtr = new osg::Node;
return objectPtr;
}
Pattern 2:
Code:
osg::Node* createObject()
{
osg::ref_ptr< osg::Node > objectPtr = new osg::Node;
return objectPtr.release();
}
Is one of these preferred? If so why?
Regards
Björn
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56560#56560
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org