
On Mon, Apr 11, 2011 at 6:44 PM, Littlefield, Tyler
Hello all: I have a quick question regarding boost::bind, as the subject line says.
This isn't a very viable example, but it works well enough to show what I want. I have a callback I am using boost::bind to bind to, and I am passing a function object in as shown by the following code: #include <cstdio> #include
#include class Math { public: void Add(int a, int b, int c, boost::function
printer); { printer(a+b+c); } }; void Printer(int p) { printf("%d\n", p); }How might I make this work? I am not sure how I can pass that as the fourth argument so that the function can be called like (1,2,3) etc. Also, in the actual problem I moved the function object to the first argument, (which just ment changing the prototype and actual function), but I still got errors.
Your test case seems to be missing the thing that is causing you
problems, and the bits provided don't compile. The following program
works for me:
#include <cstdio>
#include