hi neil, thanks for the thoughts. yeah, ref_ptr definitely traces its history back to the turn of the millennium when osg was just getting going. but as we evolve osg forward, i'm not too worried about compiler compatibility with 7 year-old compilers, esp as we might target a major rework of pointer systems to a year out or so out.
bob On Wed, Oct 1, 2008 at 4:15 PM, Neil Groves <[EMAIL PROTECTED]> wrote: > Comments inline... > > On Wed, Oct 1, 2008 at 8:43 PM, Bob Kuehne <[EMAIL PROTECTED]> wrote: >> >> hi gang, >> >> a general question for discussion. i'm interested in thoughts on why >> to preserve 'ref_ptr' vs transitioning to an external >> reference-counted pointer, like boost::shared_ptr, or perhaps the tr1 >> shared pointer (based on the boost version). >> >> ideas? thoughts? > > An external reference-counted pointer inherently has inferior locality of > reference. Typical implementations of external reference-counted smart > pointers suffer additionally from the overhead of allocating the count > object. In most cases the external reference-counted smart pointer is still > perfectly acceptable and to tune this is often premature optimisation. > However in the case of a scene graph I think we are better using an internal > atomic reference counted pointer like the one already in OSG. If we are > looking to an alternative from boost the most similar would be > boost::intrusive_ptr. > > It is possible to modify ref_ptr so that it would be safely interoperable > with boost::intrusive_ptr and have both pointers manipulate the same > underlying reference count. > > I suspect that the practical motivation for not using something else is that > OSG works on very old compilers that do not have TR1. So to make things work > it is easier to supply an OSG specific pointer. What would be great is for > support for smart pointer interoperability. I would be happy to assist if I > can get an idea of which smart pointers people like to use with OSG. > >> >> bob >> >> ps - neil, nice cleanup and addition, btw. thanks! >> >> On Wed, Oct 1, 2008 at 3:29 PM, Jean-Sébastien Guay >> <[EMAIL PROTECTED]> wrote: >> > Hi Neil, >> > >> > Nice work, I for one think it would be nice and would go a long way >> > towards >> > being able to use ref_ptr all the time to promote safe practices, >> > instead of >> > using raw pointers when needed (which is confusing to newbies). >> > >> >> Is the community aware of the 'unspecified_bool_type' idiom used within >> >> boost smart pointers to allow safe conversion to bool? If the community >> >> wishes I would be happy to add this feature. >> > >> > You mean for testing a ref_ptr directly instead of having to use >> > ref_ptr::valid() ? That would be nice too (though minor, it's just a >> > little >> > less verbose and matches pointer idioms). >> > > > That is exactly what I was referring to. I also thought it was minor > compared to the converting copy constructor and assignment operator, hence I > separated the submissions. > > Thanks for the feedback guys. > >> >> > J-S >> > -- >> > ______________________________________________________ >> > Jean-Sebastien Guay [EMAIL PROTECTED] >> > http://www.cm-labs.com/ >> > http://whitestar02.webhop.org/ >> > _______________________________________________ >> >> -- >> bob kuehne >> founder and ceo - blue newt software >> www.blue-newt.com 734/834-2696 >> _______________________________________________ > > Regards, > Neil Groves > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > -- bob kuehne founder and ceo - blue newt software www.blue-newt.com 734/834-2696 _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
