This lambda fails because I haven't captured the variable:
int val = 5; auto lambda = []{ return val; }; lambda();
But I'm curious why ostream cout works although it wasn't captured:
auto lambda = []{ cout << endl; };
Why is that?
Aucun commentaire:
Enregistrer un commentaire