#include <iostream>
#include <functional>
using namespace std;
void dynamic_dispatch(const function<int()> &callback) {
cout << "dynamic_dispatch: " << callback() << endl;
}
int main() {
int x = 1;
int y = 2;
auto closure = [&] { return x + y; };
dynamic_dispatch(closure);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgZHluYW1pY19kaXNwYXRjaChjb25zdCBmdW5jdGlvbjxpbnQoKT4gJmNhbGxiYWNrKSB7Cgljb3V0IDw8ICJkeW5hbWljX2Rpc3BhdGNoOiAiIDw8IGNhbGxiYWNrKCkgPDwgZW5kbDsKfQoKaW50IG1haW4oKSB7CglpbnQgeCA9IDE7CglpbnQgeSA9IDI7CgkKCWF1dG8gY2xvc3VyZSA9IFsmXSB7IHJldHVybiB4ICsgeTsgfTsKCQoJZHluYW1pY19kaXNwYXRjaChjbG9zdXJlKTsKCQoJcmV0dXJuIDA7Cn0=