Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-03-08 09:40:38


Some quick comments about 8.2, relation to Boost.Bind:

* Bind supports up to nine arguments and is easily extended to N. The
current implementation of Lambda has only three placeholders defined.

* 8.2.1: I consider this a minor incompatibility with a simple workaround. I
can't change Bind to match Lambda because Bind has much simpler type
deduction and cannot infer the return type when the function object is a
nested bind.

* 8.2.2: This is a more serious issue. FWIW, experience with Boost.Bind
shows that the stricter arity checking in this particular case doesn't
increase safety significantly; the most common arity errors are (1) arity
mismatch between the function object and the number of bind() arguments, and
(2) accessing an element (with _N) that doesn't exist.

I consider Bind's ability to ignore input arguments (regardless of their
placement) important, since it directly supports one of its uses: a
"signature adaptor." Often, you have a boost::function<> with a specific
signature and a concrete function that is almost compatible with it, except
that it doesn't need the third function<> argument, has the first and the
second reversed, and needs zero for its third. bind(f, _2, _1, 0) and you're
done.

In effect what I'm trying to say is: I would very much like to see a Lambda
that can eat bind_test.cpp. :-) (And a perfect world where all C++ compilers
conform, so I can retire as a Bind maintainer. :-) )

In other news, I've updated Bind in the CVS to use inline functions as
placeholders.


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