Hi Maik? Klein? how do you like to be addressed? On 29 April 2013 00:53, Maik Klein <maikkl...@googlemail.com> wrote: > I am wondering if it is possible to use the c++11 smartpointer instead of > osg::ref_ptr? Is there any advantage in using the osg::ref_ptr?
As others have said osg::ref_ptr<> is an intrusive smart pointer like boost::intrusive_ptr<>, and osg::observer_ptr<> is kinda equivalent to weak_ptr<>. The OSG doesn't have or use an equivalent to std::shared_ptr<>, and if I were to write a new scene graph tomorrow I would not use a std::shared_ptr<> for general nodes in the scene graph. shared_ptr<> isn't as robust as ref_ptr<> in general usage as you are forced to use a single shread_ptr<> group to reference a single object, you can't just assign a C pointer to a node and create your own shared_ptr<> to it as it breaks the design and you'll end up with dangling pointers. This design problem with shared_ptr<> forces you to copy shared_ptr<>'s all the time when access data members which just can't be efficient and requires end users to always stick to this rule. It's a shame that intrusive_ptr<> isn't part of the standard. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org