From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-13 07:32:39
From: "David Abrahams" <david.abrahams_at_[hidden]>
> Was the feature mentioned here
> http://aspn.activestate.com/ASPN/Mail/Message/1169892 ever documented? If
> so, I don't see it. If not it would be really great to get it into the
> documentation on the release candidate branch before we release boost
No, the feature isn't documented yet. It's still labeled "experimental" in
my mind... I'll document it post-release.
> BTW, the important question I was trying to answer was: if I have such a
> binder, what must the argument to the function which gets the value be?
> std::pair<int,int> x(1,2);
> bind(&std::pair<int,int>::first, _1)(&x); // legal?
Legal, except that &x is an rvalue and cannot be forwarded. The argument
follows the typical mem_fn rules, i.e. can be a pointer, reference, or a
smart pointer with get_pointer defined.
void noop(std::pair<int, int> *)
std::pair<int, int> x(1, 2);
boost::bind(&std::pair<int, int>::first, _1)(x);
std::pair<int, int> * p = &x;
boost::bind(&std::pair<int, int>::first, _1)(p);
boost::shared_ptr< std::pair<int, int> > p2(&x, noop);
boost::bind(&std::pair<int, int>::first, _1)(p2);
(BTW why is the Reply-To header broken?)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk