|
Boost : |
From: Steven Watanabe (steven_at_[hidden])
Date: 2006-12-09 22:06:30
AMDG
"Peter Dimov" wrote:
> ali f wrote:
>
>> > Hi again,
>> >
>> > ok, here's my actual real world situation:
>> >
>> > win->on_mouse_move.connect(
>> > args_cast<2, bool(int,int,bool,int)>( (
>> > lambda::var(x) = lambda::_1,
>> > lambda::var(y) = lambda::_2,
>> > true
>> > ) )
>> > );
>>
> The following: win->on_mouse_move.connect( ( lambda::var(x) =
> lambda::_1, lambda::var(y) = lambda::_2, lambda::_4, true ) ); would
> be Lambda's way to make it accept four arguments and only use the
> first two; it doesn't subscribe to boost::bind's philosophy of
> automatically ignoring extra arguments. Unfortunately, Lambda doesn't
> have _4, which makes the suggested workaround a bit limited. :-) Your
> attempt at using boost::bind with it didn't work probably because you
> didn't specify a return type. Try boost::bind<bool>.
Even that isn't enough. You need:
win->on_mouse_move.connect(
boost::bind<bool>( unlambda((
lambda::var(x) = lambda::_1,
lambda::var(y) = lambda::_2,
true
)), _1, _2 )
);
This compiles fine.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk