#include <iostream>
int main() {
auto&& function = [](int i0) {
int i = i0;
return [=]() mutable { i *= 2; return i;};
};
auto fn = function(5);
for ( unsigned long i = 0; i != 10; ++i )
std::cout << "\t" << fn() << "\t|";
std::cout << "\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgppbnQgbWFpbigpIHsKCWF1dG8mJiBmdW5jdGlvbiA9IFtdKGludCBpMCkgewoJCWludCBpID0gaTA7CgkJcmV0dXJuIFs9XSgpIG11dGFibGUgeyBpICo9IDI7IHJldHVybiBpO307Cgl9OwoJYXV0byBmbiA9IGZ1bmN0aW9uKDUpOwoJZm9yICggdW5zaWduZWQgbG9uZyBpID0gMDsgaSAhPSAxMDsgKytpICkKCQlzdGQ6OmNvdXQgPDwgIlx0IiA8PCBmbigpIDw8ICJcdHwiOwoJc3RkOjpjb3V0IDw8ICJcbiI7CglyZXR1cm4gMDsKfQ==