[Cs3] generalized lambda capture
Mikhail Nesterenko
mikhail at cs.kent.edu
Tue Sep 26 23:05:22 EDT 2023
CS3 students,
This question showed up today while discussing lambda variable
capturing disciplines. Specifically, is it possible to capture an
r-value reference in Lambda? Apparently, the answer is "yes" as of
C++14. It is called generalized lambda capture. So this is legal:
auto lambda = [value = std::move(ptr)] {return *value;};
More info is here:
https://en.wikipedia.org/wiki/C%2B%2B14#Generic_lambdas
Thanks,
--
Mikhail
More information about the cs3
mailing list