News for hackers. Stuff that matters.
Re:New C++ features – lambdas by evanpw on Wednesday October 28, 2015 @03:37PM (#10466776)
I often prefer to use lambdas as (named) inline function definitions:

  auto lessGold = [](const Hero& h1, const Hero& h2)
  {
      return h1.inventory().gold() < h2.inventory().gold();
  };

  std::sort(heroes.begin(), heroes.end(), lessGold);
Re:New C++ features – lambdas by AnimalMuppet on Wednesday October 28, 2015 @04:00PM (#10466940)
Interesting. In C++, a variable can have global scope, file scope, class/object scope, or local scope. A function can have global scope, file scope, or class/object scope. This lets you create a function that has local scope.
Re:New C++ features – lambdas by doomrobo on Wednesday October 28, 2015 @04:11PM (#10467038)
You can even do that in C (non-standard, of course) using clang with the Blocks extension