Carsten Neumann wrote:
> Hello,
>
> Marcus Lindblom wrote:
>> GeometryRefPtr geo = dynamic_pointer_cast<Geometry>(node->getCore());
> ^^^^^
> I think this has to be dynamic_cast<Geometry *>(...) (this may be needed
> in other places as well)
>
> The {dynamic,static}_pointer_cast functions are only necessary when the
> *source* pointer is one of the OpenSG RefPointer types (i.e. FooRefPtr,
> FooUnrecPtr, FooWeakPtr, etc.).
Right. I thought it was, actually, but that's my old 1.8 brain talking. :)
> I think I had once added support for {dynamic,static}_pointer_cast to
> work on raw pointers (i.e. Foo *) as well, but it got removed - perhaps
> it had problems with certain cases?
> IMHO it is more convenient for users not having to worry about whether a
> function returns a raw pointer or a ref pointer and allow everyone to
> just write dynamic_pointer_cast for all cases, those that like to save a
> few keystrokes are of course free to use dynamic_cast directly where
> possible.
> The other thing to consider here is perhaps what boost does? Does anyone
> know if the boost::dynamic_pointer_cast<>() for their boost::shared_ptr
> works with raw pointers?
Haven't tried that, but I agree it would be nice to have, if it worked.
Cheers,
/Marcus
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users