Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-06-24 04:41:17


From: "David Abrahams" <david.abrahams_at_[hidden]>
> From: "William Kempf" <williamkempf_at_[hidden]>
>
> > Another option is to provide a standalone templated get_raw_ptr() method
> > that's specialized to just return the pointer if it's not a smart
pointer
> > and return get() otherwise. Then anywhere in your implementation where
> you
> > call p.get() you instead call get_raw_ptr(p).
>
> Do you mean get_pointer()?
>
> file:///C:/boost/libs/bind/mem_fn.html#get_pointer
>
> It's already specialized for all our smart pointers AFAIK, but also AFAIK
> there's no documentation to that effect :(

The get_pointer overload for shared_ptr was originally defined in mem_fn.hpp
(and documented there.) I've moved it to shared_ptr.hpp where it belongs but
the documentation seems to have mysteriously vanished. Wonders never cease.

get_pointer is somewhat overloaded in the sense that mem_fn allows
get_pointer to return anything usable in a get_pointer(x)->*f(...)
experssion, i.e. it's not limited to raw pointers. I should have named it
'mem_fn_get_pointer.'

I guess the right thing to do is to document 'get_pointer(px)' as returng
the raw pointer contained in px on the smart pointer side, and make
mem_fn_get_pointer forward to it on the mem_fn side. Comments?


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