#include <functional>
#include <iostream>
int foo(double d) { std::cout << d << '\n'; return 0; }
char bar(double d) { std::cout << 2*d << '\n'; return '0'; }
int main() {
std::function<void(double)> cb;
cb = foo; cb(1.0);
cb = bar; cb(2.0);
return 0;
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCmludCBmb28oZG91YmxlIGQpIHsgc3RkOjpjb3V0IDw8IGQgPDwgJ1xuJzsgcmV0dXJuIDA7IH0KCmNoYXIgYmFyKGRvdWJsZSBkKSB7IHN0ZDo6Y291dCA8PCAyKmQgPDwgJ1xuJzsgcmV0dXJuICcwJzsgfQoKaW50IG1haW4oKSB7CglzdGQ6OmZ1bmN0aW9uPHZvaWQoZG91YmxlKT4gY2I7CgkKCWNiID0gZm9vOyBjYigxLjApOwoJCgljYiA9IGJhcjsgY2IoMi4wKTsKCQoJcmV0dXJuIDA7Cn0=