Which is slower, in general, using std::iterators or using operator[], when available.
e.g., say you have an std::vector<int> int_vector, you could loop through in a couple of different ways:
Tests using both high and low resolution timers give inconsistent results. Which is typically seen as the "better" method to use? My guess is they're both ultimately pretty much the same thing under the hood.PHP Code:
for(int i = 0; i , int_vector.size(); i++)
{
int this_int = int_vector[i]; //same as int_vector.at(i)
}
...
for(std::vector<int>::iterator ptr = int_vector.begin(); ptr != int_vector.end(); ptr++)
{
int this_int = *ptr;
}