I am just wondering how to write a Lambda function in C++ that 'remembers' a value passed into it? Specifically I am thinking of the i=i syntax from Python as follows:
funs = [(lambda i=i: print i) for i in range(5)]
I was also wondering what the technical name (if one exists for this) would be? (I know that if I knew the answer to the second question I could just Google for the solution...)
Also, I am still getting used to asking questions on StackOverflow (have been doing my best to read the docs) and would really appreciate feedback on how I can make my questions better!
Aucun commentaire:
Enregistrer un commentaire