I think lambda is elegant when using stl
functions like , or you want quick throw away functions without naming them .
sort(v.begin(),
v.end(),
[](int a, int b){ return a > b; }
);
but it's not faster from the function .
Disassembly of both .
helloWorld1();
008112A0 mov ecx,dword ptr ds:[813054h]
008112A6 push 8119A0h
008112AB call std::operator<< > (0811780h)
008112B0 mov ecx,eax
008112B2 call dword ptr ds:[813038h]
helloWorld2();
008112B8 mov ecx,dword ptr ds:[813054h]
008112BE push 8119A0h
008112C3 call std::operator<< > (0811780h)
008112C8 mov ecx,eax
008112CA call dword ptr ds:[813038h]
both have the same disassembly.