Robert,

While speaking of the new C++11 standard, do you have any plans or have you 
thought about how to start introducing new parts of the language?  Doing so 
would obviously break the build for those with non-compliant compilers, and the 
ugliness of #ifdef'ing old and new syntax is very unappealing.

Does this mean OSG will remain C++03 for the foreseeable future (not a bad 
thing)?  Are there any triggers that you have identified that could indicate 
when it is beneficial to move to C++11 (i.e. less use of older compilers in the 
community)?

For smaller projects, or newer projects, the decision about using or not using 
C++11 is sometimes easier to make, but I'm curious about your thoughts for 
OSG's present and future.

Thanks,

John Shue

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Robert Osfield
Sent: Thursday, August 01, 2013 2:21 AM
To: [email protected]
Subject: Re: [osg-users] Using c++11 smartpointer instead of osg::ref_ptr?

Hi Maik? Klein? how do you like to be addressed?

On 29 April 2013 00:53, Maik Klein <[email protected]> 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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

This e-mail and any attachments are intended only for the use of the 
addressee(s) named herein and may contain proprietary information. If you are 
not the intended recipient of this e-mail or believe that you received this 
email in error, please take immediate action to notify the sender of the 
apparent error by reply e-mail; permanently delete the e-mail and any 
attachments from your computer; and do not disseminate, distribute, use, or 
copy this message and any attachments.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to