#include <functional> #include <iostream> int main() { std::function<int (int)> hello = [&](int i)->int { if (--i != 0) hello(i); std::cout << "Hello, World!" << std::endl; return 0; }; return hello(10); }
Standard input is empty
Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World! Hello, World!