auto lambdaFunction1 = [](someClass& obj, int x){/**/};
auto lambdaFunction2 = [&someClassObj, x](){/**/};
Will there be any performance difference for using lambda that captures variables or passing them as parameters? If I'm in position that I can use whatever, should I always prefer one of those options over other? Are there any rules about that? Or it's just a matter of which one likes?
PS: I'm aware that in same cases I will have don't have such choice, for example using stl algorithms, I'm asking about situation where I can use both
Aucun commentaire:
Enregistrer un commentaire