From: Samuel Krempp (krempp_at_[hidden])
Date: 2003-09-17 03:41:40
le Wednesday 17 September 2003 05:16, dave_at_[hidden] écrivit :
>>> That way, bind(&X::member, _1, value) would be useful.
>> The motivation for my request is that bind(f, a1, a2, ... an)
>> currently has an invariant that f is a function-like object taking n
>> parameters, except if f is a member pointer, then a1 is a (smart)
>> pointer or reference to the object, and the function itself (if it is
>> a function) takes n-1 parameters. The degenerate case of f being a
>> member data pointer coincides nicely with a member function pointer
>> taking 0 parameters.
> Sorry, you lost me.
simply put, with your suggestion you couldn't tell the difference between
assigning to a member or calling a 1-ary member function anymore.
bind(&X::member, _1, val) (x); // assigns member, or calls member(val) ?
Currently, a member data (only) behave like a 0-ary member function, and I
agree with Howard that it's nice.
bind(assign<T>(), bind(&X::member, _1), val) (x);
is a bit more verbose, but it could help human reading of long bind
expressions, spotting easily where assignments take place. Then again,
maybe not, I don't use bind that much.
(I guess you dont need assign if using boost::lambda
bind(protect(_1 = _2), bind(&X::member, _1), val) (x);
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk