void f(int x) { std::cout << x << " f\n"; }
void f(int x, int y) { std::cout << x << y << " g\n"; }
struct A{
int i;
std::function<void(int)> f;
};
int main() {
A a;
a.i = 1;
a.f = f;
a.f(a.i);
return 0;
}
prog.cpp: In function ‘int main()’:
prog.cpp:15:8: error: no match for ‘operator=’ (operand types are ‘std::function<void(int)>’ and ‘<unresolved overloaded function type>’)
a.f = f;
^