callback and boost:function
Guys, First thank you for a wonderful library and all the hours of work that is put into boost to make it what it is today. Is there anyway in C++ to setup a callback to a member function that takes two arguments I am trying to use boost::function but that only works with std::bind1st that does only take one parameter. I want to wrap some existing C code with C++. The function I want to call back is declareed like this: struct X { double foo(double x , void * p); }; Idealy I would like to use lambda to remove the void* and replace it with _1, _2 etc. But I am not sure how that works with callbacks. I had a look at the libsigc++ that seems to be able to handle callbacks with more arguments but the lambda stuff does not work under Visual Studio 2003 at least. Regards Lars Schouw --------------------------------- Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
<snip>
I want to wrap some existing C code with C++. The function I want to call back is declareed like this: struct X { double foo(double x , void * p); };
Idealy I would like to use lambda to remove the void* and replace it with _1, _2 etc. But I am not sure how > that works with callbacks.
Use boost::bind or boost::lambda::bind. For example:
// An instance of x
X x;
// A binary function
boost::function
participants (2)
-
Delfin Rojas
-
Lars Schouw