Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-13 10:32:45


From: <sgregory_at_[hidden]>
> I'm trying to write code portable to SunC++ (5.2) and MSC++ (6.0).
> And am having problems with std::mem_fun or boost::mem_fn with a
> class member function that returns void.
>
> // pseudo-example code
> struct A {
> void func(const double);
> };
> std::for_each(arr.begin(), arr.end(),
> std::bind1st(std::mem_fun(&A::func),&arr)); // fails
> std:;for_each(arr.begin(), arr.end(),
> std::bind1st(boost::mem_fn(&A::func),&arr)); // also
> fails
>
> Should using boost::mem_fn fix the 'void return' problem of MS?

Unfortunately not (yet.) Even

std::for_each(arr.begin(), arr.end(), boost::bind(&A::func, &a));

will currently fail for a 'void' return on MSVC.

--
Peter Dimov
Multi Media Ltd.

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