#include <iostream>
#include <functional>
int main() {
std::function<int()> xs[10];
for (int i = 0; i < 10; i++) {
xs[i] = [&i]() { return i; };
}
std::cout << xs[5]() << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KCmludCBtYWluKCkgewoJc3RkOjpmdW5jdGlvbjxpbnQoKT4geHNbMTBdOwoJZm9yIChpbnQgaSA9IDA7IGkgPCAxMDsgaSsrKSB7CgkJeHNbaV0gPSBbJmldKCkgeyByZXR1cm4gaTsgfTsKCX0KCXN0ZDo6Y291dCA8PCB4c1s1XSgpIDw8IHN0ZDo6ZW5kbDsKCXJldHVybiAwOwp9