shellmad-10_C++新特性 lambda表达式与匿名函数_哔哩哔哩_bilibili
#include <iostream> #include <string> #include <unordered_map> using namespace std; int main() { int c=[](int a,int b) -> int{ return a+b; }(3,5); cout<<c<<endl; return 0; }
#include <iostream> #include <string> #include <unordered_map> using namespace std; int main() { auto f =[](int a,int b) -> int{ return a+b; }; cout<<f(8,9)<<endl; return 0; }