Can lambda\'s be defined as class members?
For example, would it be possible to rewrite the code sample below using a lambda instead of a function object?
A lambda just makes a function object, so, yes, you can initialize a function member with a lambda. Here is an example:
#include #include struct Example { Example() { lambda = [](double x) { return int(std::round(x)); }; }; std::function lambda; };