I have api function f_api(std::function<void(int)> func)
and now I have my process class
class Func {
public:
void operator()(int i) {
// do some work
}
int operator()(int i, int j) {
// do some other work
}
};
and I want use Func f
f(int i) to pass to f_api to do the work; so I use std::bind
Func f;
std::function<void(int)> func = std::bind(&Func::operator(), &f, std::placeholders::_1);
f_api(func);
but HERE the problem, How can I indicate which Func::operator()()
I want to bind? I can give a member function by its name, but how can I process this when this member function do have several different signed reloading function? Will std::bind find me the most suitable function to be called? C++ is so complicated, Help me plz....
Aucun commentaire:
Enregistrer un commentaire