What you're trying to do is the PIMPL design pattern.  I'll leave the details 
to Google :)

You may also want to brush up on the Factory design pattern for generating your 
opaque handles.

In a direct answer to your question, no you can't use a void* to store a 
ref_ptr<> (without some trickery). You can, however, store a pointer to a 
ref_ptr<> as a void* . Then when you need to use it, convert it like this to 
avoid having to double dereference it every time you use it.


Code:
ref_ptr< Node> &node = *reinterpret_cast< ref_ptr< Node> *>(mysteryPtr);



And don't forget to delete the pointer to the ref_ptr<> when you're done. if 
you leak the ref_ptr<> the node will never get collected.

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to