[osg-users] META_object macro returning osg::Object* for cloneType and clone

Julien Valentin julienvalentin51 at gmail.com
Sun Nov 26 12:15:52 PST 2017


Hi
I don't understand your ex: 
If you clone a list of Object you'll get...a list of Object...you can't forsee their type...
Further why don't u static cast when you're sure of the return type?...



hartwigw wrote:
> Hi,
> 
> if you have a list of pointer of derived classes from osg::Object and you would like to clone them you always have to cast them. And I like to prevent casts as often as possible.
> 
> Example: if you clone a StateAttribute you get back a pointer to an Object although you know (and the compiler could also know) that the result is a StateAttribute.
> 
> Cheers,
> Hartwig


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72462#72462







More information about the osg-users mailing list