Mathias Fröhlich wrote:
> Hi Tim,
> 
> On Sunday 05 July 2009 22:51:32 Tim Moore wrote:
>> We can now rely on std::tr1:shared_ptr and its cousins, through Boost if
>> need be, so perhaps we could come up with some nice templates to paper over
>> the differences between OSG pointers an our own.
> Vote against.
> You will need two allocations for a new object that is used with the the 
> std::shared_ptr implementation - one for the object and one for the reference 
> count. I like to use that SGReferenced stuff for many small lightweight 
> objects 
Note that I said "and its cousins." I had thought that TR1 includes boost's
intrusive_ptr, but now I see that it doesn't. No matter; it is in boost and 
available.
This wouldn't replace your implementation of SGReferenced or osg::Referenced, 
but
simplifies access to them by clients who wouldn't have to care about the 
specific
type of the reference-counted object.
> that should not take to much time to create and should not take too much 
> space. That kind of the solution is the most lightweight one I can think of. 
> Also you can no longer work with raw pointers passed around and use the 
> reference count included in the object since the shared_ptr implementation 
> has 
> a separate count object. If you do so you will end up with two reference 
> counts for the same object. The current implementation avoids that and make 
> raw pointer based apis if required.
I'm not a big fan of std::shared_ptr either.
> 
> So alltogether we have with the SG* version something that works equally well 
> than the shared_ptr/weak_ptr pair and provides some extra features I would 
> like to have.
> 
> The SGAtomic counter could make use of the std::atomic at some point - if we 
> add an additional case int the current implementation selection when we have 
> that available.
> This could be done without loosing any of the features we have available in 
> our current SharedPtr/WeakPtr implementation.
>
Again, I'm not proposing getting rid of SGReferenced; I'd just like a unified 
way
to use different pointer implementations.

Tim

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to