Boost logo

Boost Users :

Subject: [Boost-users] a quick question regarding boost::bind, with a test case
From: Littlefield, Tyler (tyler_at_[hidden])
Date: 2011-04-11 13:44:32

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 <boost/bind.hpp>
#include <boost/function.hpp>

class Math
void Add(int a, int b, int c, boost::function<void (int)> printer);

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.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at