mercredi 5 juillet 2017

passing iterators to lambda

I want to use the lambda expression for the following codes,

long long noOfways =0;
 auto dist =0;
 for(auto iter = noChocolets.begin()+1;iter!=noChocolets.end();iter++)
 {   
     dist+=*(iter)-*(iter-1);
     noOfways+=  minOper(dist);
 }

I particularly want to convert for loop to a lambda expression. How can I do that?

Aucun commentaire:

Enregistrer un commentaire