📜  函数内的 c++ 函数 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:48.251000             🧑  作者: Mango

代码示例1
int main() {
    // This declares a lambda, which can be called just like a function
    auto print_message = [](std::string message) 
    { 
        std::cout << message << "\n"; 
    };

    // Prints "Hello!" 10 times
    for(int i = 0; i < 10; i++) {
        print_message("Hello!"); 
    }
}