I need to pass a non-static member function to a parameter
class Foo {
void f() {}
void caller() {
//calling of g() happens here using f()
}
};
Class Goo {
std::map<int,std::vector<std::function<void()>>>> m;
void g(int i, std::function<void()> const& h) {
m[i].push_back(h);
}
}
I tried calling
g(f), g(Foo::f), g(std::make_fn(Foo::f), g(std::make_fn(Foo:f, this), g(this.f)
and also also tried to pass it as reference (althought it should ).
The error i get is of invalid use of nonstatic member function.
Edit: I added the functionality behind g()