Boost logo

Boost :

From: ali f (k9eks_at_[hidden])
Date: 2006-12-09 05:48:50


I had already tried it with the explicit return type. Doesnt work with that
either. Steven Watanabe hit the spot though, the addition of unlambda did
it. I suppose it's how boost.signals handles the function calls...

thanks guys

- ali

----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.devel
Sent: Sunday, December 10, 2006 6:24 AM
Subject: Re: new utility: function parameter caster

> Steven Watanabe wrote:
>
>> Even that isn't enough. You need:
>> win->on_mouse_move.connect(
>> boost::bind<bool>( unlambda((
>
> 'unlambda' would be necessary with boost::lambda::bind, but it isn't
> needed
> for boost::bind. The following works for me.
>
> #include <boost/lambda/lambda.hpp>
> #include <boost/bind.hpp>
> #include <boost/function.hpp>
> #include <iostream>
>
> int main()
> {
> int x = 0, y = 0;
>
> boost::function< bool( int, int, bool, int ) > on_mouse_move;
>
> namespace l = boost::lambda;
>
> on_mouse_move = boost::bind<bool>( (l::var(x) = l::_1, l::var(y) =
> l::_2, true), _1, _2 );
>
> on_mouse_move( 1, 2, true, 4 );
>
> std::cout << x << ' ' << y << std::endl;
> }
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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