Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-03-11 15:19:50


Howard Hinnant <hinnant_at_[hidden]> writes:

> On Mar 11, 2004, at 9:42 AM, David Abrahams wrote:
>
>> This surprised me; should it have?
>>
>> #include <boost/bind.hpp>
>> #include <boost/mem_fn.hpp>
>>
>> struct X
>> {
>> int y;
>> };
>>
>> int main()
>> {
>> boost::mem_fn(&X::y); // OK
>> boost::bind(&X::y); // Error!
>> }
>
>
> I'm not seeing any surprises. mem_fn(&X::y) produces a function
> object that takes one parameter. Therefore the bind equivalent needs
> an argument or a placeholder:
>
> bind(&X::y, _1);

DUH!!

Thanks, Howard!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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