Boost logo

Boost Users :

From: David Greene (greened_at_[hidden])
Date: 2006-01-11 12:56:00


I'm debugging some even nastier lambda compiler error messages
(not sure if I can reduce to a testcase but I'll try). In the
course of figuring this out, I relized that I need to understand
the similarities and/or differences between bind operations and
->* in a lambda context.

What is the difference between these two:

class Class {
  public:
    int member_func(void);
};

bind(&Class::member_func, _1) == 1

(_1 ->* &Class::member_func) == 1

used in the context of

std::find_if(seq.being(), seq.end(), <lambda-func>);

Does the second construct make sense in this case? I don't think it
does because member_func takes no arguments. Because the ->*
expression must be followed immediately by an argument list, there
is no way to delay the substitution of the object on which to
call member_func. This, I believe, it what bind is for.

That is, ->* only delays application of n-1 arguments, where n
is the total arity of the function (including the hidden "this"
parameter).

Bind is able to delay application of all n arguments.

Is this analysis correct?

                              -Dave


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net