lambda表达式使用
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
void Max() //定义Max函数
{
auto p = [](int a, int b){return a > b ? a : b; };
cout << p(1, 2) << endl;
}
int main(void)
{
Max();
while (1);
return 0;
}
#笔经#
#include <iostream>
using namespace std;
void Max() //定义Max函数
{
auto p = [](int a, int b){return a > b ? a : b; };
cout << p(1, 2) << endl;
}
int main(void)
{
Max();
while (1);
return 0;
}