Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-05-03 10:48:57


From: "Geurt Vos" <G.Vos_at_[hidden]>

> BTW, about bind, I haven't really looked into it all,
> but how 'complex' is it going to be? Consider the
> following example:
>
> class C {
> public:
> void Func(int,int,int);
> };
>
> int main()
> {
> C c;
> boost::function<void,int,int> f;
> f = boost::bind<1>(&C::Func,c,100);
> f(1,2); // will call C::Func(1,100,2)
> }
>
> Can bind do this or similar or is it too much?

The current "bind" in lambda can (AFAIK) do this, although the syntax is a
bit different:

bind(&C::Func, c, free1, 100, free2);

My favorite syntax for this is

bind(&C::Func, c, _, 100, _);

--
Peter Dimov
Multi Media Ltd.

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