Value max = values[0];
int index = 0;
for(int loop = 1; loop < size; ++loop)
{
max = std::max(max, values[loop]);
}
// Modified based on comments. To get index use:
Value max = values[0];
int index = 0;
for(int loop = 1; loop < size; ++loop)
{
if (max < values[loop])
{
index = loop;
max = values[loop];
}
}
If The type of Value (which holds your int/float) pair is actualy typedefed to std::pair<int, float>std::pair<int, float> then this is the default behavior.