Is it possible to access (read only) the variables captured by a lambda?
This doesn't work:
std::function<double (const double)> plus (const double a) {
return [a] (const double b) -> double {
return a+b;
};
}
auto plus5 = plus(5);
cout << plus5.a << endl;
Thanks for your help.
Aucun commentaire:
Enregistrer un commentaire