Hi,

On 2/10/08 4:27 PM, Mathias Fröhlich wrote:
Code like this:

shared_ptr<Node>  node(new Node);
Node* rawNode = node.get();
shared_ptr<Node>  nodePointerWithDifferentReferenceCountObject(rawNode);

This will end up with two different reference count instances for a single
object instance.

Yes, but this is a usage error w.r.t. shared_ptr<>.
You always need to pass the shared_ptr<> but that works just as well.

Note that this kind of usage pattern happens quiet often in osg ...
... think of adding nodes to a group and adding the same node to an other
group and many more.

The OSG API would have to be adapted of course so that the raw pointers are never passed back but only references (or copies) of the internal shared_ptr<>.

I'm not trying to advocate usage of shared_ptr<> in OSG, I'm just saying it could be done - but it would also break a lot of code.

Cheers,
/ulrich
_______________________________________________
osg-submissions mailing list
osg-submissions@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to