Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-12-09 22:24:46


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;
}


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