Let's say I have the following const vector of pointer :
const std::vector<Component*> components;
and I want to iterate through it and only calling a method on one element of this vector. Is it correct to do :
for (const auto& item : components) {
method(item);
}
What is the difference with using :
for (auto item : components) {
method(item);
}
with :
void method(Components* component);