lundi 25 octobre 2021

Should I use for iterators instead of for range based loop, if so, why?

I just learned about iterators. Should I use this?

for (auto& i : just_a_vec )

Or this?

for (std::vector<std::string>::iterator it = just_a_vec.begin(); it < just_a_vec.end(); it++)

And if so, why this is the case?

Aucun commentaire:

Enregistrer un commentaire