3 ms·
Very cool, but fortunately soon to be unnecessary: http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions http://en.wikipedia.org/wiki/C%2B%2B0
by tbrownaw 17y ago
Very cool, but fortunately soon to be unnecessary: http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_...
Also, real currying in C++0x: http://pastebin.com/KRraz7iU http://pastebin.com/KRraz7iU
- tman 17y agoUnfortunate that this is one part of the C++0x g++ project that has yet to get serious. (At least the last time I checked out the g++ experimental code a few months ago.) C++0x lambdas are the one thing that I've been wanting to try out for years. Instead, we got a lot of (now somewhat wasted) effort on concepts. I like concepts in principle, but too many C++ people saw concepts as a way to write provable code and unreadable library documentation instead of as a way to simplify compiler error messages.
- scott_s 17y agoPrepare to be pleasantly surprised: http://gcc.gnu.org/projects/cxx0x.html http://gcc.gnu.org/projects/cxx0x.html
- fadmmatt 17y agoNeat; but C++0x does this: [](int x, int y) { return x + y; } instead of this: lambda<int> (x,y) --> x + y Ironically, the template hack could be shorter in many cases.
- tbrownaw 17y agoAnd those few extra characters give you an enormous amount of flexibility, such as not needing to define wrapper template specializations for all your types, not needing to have extra variables sitting around to define your argument placeholders, and being able to use more than just simple expressions.