Hello all,
It was pointed out to me that the subject line was not correct, so I resent
this mail with a correct subject line.
I'm not sure if this is possible at all, but let me explain:
I have the following function signature:
typedef int (*sasl_callback_ft)(void);
That function in question gets called with unknown amount of parameters
(usually 3 or 4)
Now I want to assign a member function to it:
class admin {
public:
int callback_fun(void *context, int id, const char **result,
unsigned *len);
}
boost::function callback =
boost::bind(&admin::callback_fun, this, _1, _2, _3, _4);
Obviously the compiler doesn't allow to assign callback to a
sasl_callback_ft var
sasl_callback_ft fun = callback;
I get compiler errors like:
matthijs@hammer:~/t2$ clang++ -o main -std=c++11 main.cpp
main.cpp:22:19: error: no viable conversion from 'boost::function' to 'sasl_callback_ft'
(aka 'int (*)()')
sasl_callback_ft cbfun = cb;
^ ~~
/usr/include/boost/function/function_template.hpp:894:5: note: candidate
function
operator safe_bool () const
^
1 error generated.
Attached the testcase I made for this.
Regards, Matthijs