I'm using Boost ver 1.39.0
I have a module to which other modules can register callbacks. This
module will call those callbacks with a couple of arguments - as an
example
registerCallBack(void (*callbackFunc)(int));
At the time of callback it will call: (*callbackFunc)(3);
To
allow for any function to be registered (each module's callback may
have a different signature etc, but everyone can allow for this one
last arg), I declared it to take a
boost::function<void (int)>
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. However, assigning the return value of boost::bind where all the arguments of a function are bound (so the resulting object is a void() function) seems to work.
I'm trying
to decipher the errors, but would appreciate any help I can get. I get errors both on VisualStudio
2008, as well as g++ 4.1.2, so I'm guessing it's not some compiler
problem rather it's my usage. Attached a sample source file. I commented out the 4 lines that were giving me errors.
Thanks,
Lakshman.