I have a compile error when using std::function in a templated member function, the following code is a simple example:
#include
#include
You can make type deduction work with some variant of:
template
void setCallback(CALLBACK cb) {
typedef CALLBACK::first_argument_type T;
static_assert(is_same_type>::value);
...
}
This way CALLBACK can be determined by looking at the argument. It might get into trouble if bind doesn't actually return a std::function but rather something that can be cast as one. I'm not sure.