an example of using C++ lambda

👍 g++ -std=c++11 aplusb.cpp && ./a.out
8
👍 cat aplusb.cpp                      
#include <iostream>
using namespace std;

int main() {
  auto sum = [](int a, int b) {
    return a + b;
  };
  cout << sum(3, 5) << endl;
}
    
equivalent to

#include <iostream>
using namespace std;

int main() {
  function<int(int,int)> sum =
    [](int a, int b) -> int {
    return a + b;
  };
  cout << sum(3, 5) << endl;
}