vendredi 11 mai 2018

How to handle pointers when iterating over a collection using auto?

I have a collection:

std::unordered_set<Object*> objects;

Should I do:

for (auto& obj : objects){
     //Do some stuff
}

or

for (auto obj : objects){
     //Do some stuff
}

Which is faster ?

Aucun commentaire:

Enregistrer un commentaire