|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-06-26 11:15:11
From: "David Abrahams" <david.abrahams_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
> > From: "David Abrahams" <david.abrahams_at_[hidden]>
> > >
> > > From: "Peter Dimov" <pdimov_at_[hidden]>
> > >
> > > > 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?
> > >
> > > Do we need two separate functions?
> >
> > It would be preferable to have the finer control... if it were possible.
> I
> > forgot that you cannot forward in C++.
>
> I don't understand why finer control would be desirable, and I /really/
> don't understand what you're saying about forwarding. It seems to me that
> manual forwarding is an unfortunate fact of life in C++ library design.
Finer control:
There are three levels of access: p.get(), get_pointer(p), and mem_fn(&X::f,
p). For some pointers, only the first (arguably) should work (weak_ptr);
others need the second but not the last (*_array, probably scoped_ptr too
since it can't go in containers.)
Forwarding:
template<class P> ??? mem_fn_get_poiner(P const & p)
{
return get_pointer(p);
}
It depends on how get_pointer is specified, of course. A compromise would be
to define it for all non-array pointers sans weak_ptr.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk