Generic lambda (C++ 14)

suggest change

C++14 allows to use auto in lambda argument

auto print = [](const auto& arg) { std::cout << arg << std::endl; };

print("hello world");

That lambda is mostly equivalent to

struct lambda {
    template <typename T>
    auto operator ()(const T& arg) const {
        std::cout << arg << std::endl;

and then

lambda print;

print("hello world");

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents