Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-04-29 15:42:18


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.

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

-Jason


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