Skip to main content

Lambda functions in C++

While rewriting the niven configuration manager, I had to write lots of functions that walk over a tree and perform rather simple stuff. Unfortunately, the std::for_each function is ill-suited for such tasks as you have to write a functor class for each thing you want to do, and this really adds a lot of clutter to the code. Searching the web a bit, I've found this excellent proposal: C++ Lambda Expressions. I hope it'll make it into the next C++ standard, would really save me a lot of time.