Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-04-29 16:37:01


From: Jason Hise <chaos_at_[hidden]>
> Rob Stewart wrote:
> >From: Jason Hise <chaos_at_[hidden]>
> >
> >>But that's what the smart pointer itself already provides. In what
> >>circumstances would it be better for client code to work with a smart
> >>reference than with a smart pointer? The smart pointer provides access
> >
> >The very one you started this thread with! You asked whether
> >get_unsafe_ptr() should be spelled operator *().
> >
> >You wanted to provide access to the raw pointer/reference in
> >order to allow for polymorphic usage. The proxy to which I've
> >been referring provides a safe means for that because the client
> >can grab and hold a smart reference which can converts
> >(explicitly or implicitly, your choice) to T & and T *.
> >
> I'm sorry, I figured out where the lapse in my thinking was. I was
> initially thinking that if the smart reference would be immediately
> converted to a real reference, then the smart reference would not serve
> a purpose and the function might as well return a real reference. If it
> was holding a lock, however, then it would add thread safety while the
> raw pointers or references existed.

Eureka! Yes, you've got it now. I'm glad we broke through the
cognitive dissonance. 8-)

> I need to get more sleep so I can think more clearly :) Your idea is
> indeed a good one.

Sleep? I have eight kids! I never get enough sleep!

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk