|
Boost Users : |
Subject: Re: [Boost-users] Using boost::bind with boost::function
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-11-23 19:51:29
maruthilakshman-boost_at_[hidden] wrote:
...
> I was hoping that if I have a twoarg_callback(int, int) function, I
> can register it with the module by using boost::bind to bind the
> first argument, but that is not possible. I am unable to assign the
> return value of boost::bind to a boost::function<void (int)> object
> by binding one argument.
Use boost::bind( twoarg_callback, 3, _1 ). The 'int' in function<void(int)>
is the first argument and is addressed via _1. There is no second argument,
so _2 doesn't work.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net