Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With C++ lambdas, it's similar, but the syntax is a bit uglier:

  [](auto&& x) { return get_something_complicated(bar(x)); }
and you can decide whether you want a value (no &'s), an lvalue reference (&), or a forwarding reference (&&). I think with C++20 you can also use a concept instead of auto for a constrained parameter type.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: