mercredi 29 juillet 2020

Usage of Range Based Loop for Vector of Pointer

Hi, I am amateur. I'm stuck on range based loops.

I know how to use this:

std::vector<ExampleClass> vec;

But I don't know this one:

std::vector<ExampleClass*> vec;

which one should I use?

1:

for (auto x : vec)

2

for (auto& x : vec)

Thank you.

Aucun commentaire:

Enregistrer un commentaire