Is there a difference, in terms of performance, between the two loops below? (myvec is type std::vector<int>
.)
std::vector<int>::const_iterator pos;
for (int i = 0; i < N; i++) {
pos = myvec.begin();
// do something with pos
}
for (int i = 0; i < N; i++) {
std::vector<int>::const_iterator pos = myvec.begin();
// do something with pos
}