std::vector someVector;
for (unsigned int i = 0; i < someVector.size(); i++)
{
// do something
}
Does the value of someV
It depends on the compiler optimization.
it might Loop optimization,(if possible not mentioned something like volatile)
the compiler will put datas (irrelevant) not dependent on loop outside.
so it may generate something like
int length = someVector.length();
for (unsigned int i = 0; i < length; i++)
{
// do something
}
There are many compiler optimization techniques that it 'll do.
By default in c++ there are some "pure functions" string.length() which is always optimized. i'm not sure whether vector.size belong to that.