|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-07-10 05:54:09
From: "Sean Parent" <sparent_at_[hidden]>
> I'm trying to use bind with for_each but I need a copy of the bound
function
> object back after for_each. I've tried using boost::ref(f) but that just
> gives me a compiler error (CW 7.2) that the result type isn't defined
> (apparently on the wrapped reference.
>
> ...
> Function f;
> // How do I get a copy of f back?
> ??? = std::for_each(first, last, boost::bind(f, _1));
> ...
>
> ...
> // This won't compile
> Function f;
> std::for_each(first, last, boost::bind(boost::ref(f), _1));
> return f;
> ...
>
> Any ideas?
What version of bind? ref(f) is supported by the latest CVS. "Function"
should have a result_type, too; if it doesn't, use bind<R>(ref(f), _1).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk