4 ms·
Lambdas give you a (somewhat) saner syntax for 1. Defining a function within a function. 2. Capturing a function call for later use.
by tdsamardzhiev 10y ago
Lambdas give you a (somewhat) saner syntax for
1. Defining a function within a function.
2. Capturing a function call for later use.
- tapirl 10y agoCouldn't it be some less weird, just like the anonymous functions in JavaScript and Go? Even the lambda in Java is much readable than c++. It give me the feeling that, c++ gives every corner a special syntax, or c++ adds new features by adding new syntaxes, there is no the word "reuse" in the process of improving c++. In go, anonymous functions and general functions and methods have no much differences. But in c++, lambda and general functions and class methods are too different. Using class methods as callback in c++ is awful. C++1x features make c++ code less readable, for fewer and fewer programmers know every syntax corners in c++.