5 ms·
std::function and lambdas are two very different things. std::function can store a lambda, but it is a memory-allocating library class, while a lambda is a lang
by hellofunk 9y ago
std::function and lambdas are two very different things. std::function can store a lambda, but it is a memory-allocating library class, while a lambda is a language-level construct. Very important to understand the distinction between these two.
- AstralStorm 9y agoThere are improved template magic versions of std::function that do not inhibit inlining for stateless lambdas passed directly thanks to additional magic. At worst the overhead is a function call anyway and inhibition of inlining in the error path. Generally nothing to worry about.
- hellofunk 9y ago> There are improved template magic versions of std::function But not in the standard library. Of course, in C++, you can do anything if you venture outside the standard.