Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-09-17 15:49:16

Samuel Krempp <krempp_at_[hidden]> writes:

> 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) ?

I don't think it can call member(val). That would have to be:

  bind(&X::member, _1)(x)(val)


  bind(&X::member, x)(val)

wouldn't it?

> Currently, a member data (only) behave like a 0-ary member function,
> and I agree with Howard that it's nice.

A matter of taste I guess.

> 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.

To me it just looks like gibberish (no offense). How does it work?
Why should it be neccessary to specify <T>?

> (I guess you dont need assign if using boost::lambda
> bind(protect(_1 = _2), bind(&X::member, _1), val) (x);
> )
> --
> Samuel
> _______________________________________________
> Unsubscribe & other changes:

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at