I have already tried the below code but i want to use this same function for sorting based on different columns.
This given code is sorting based on first column only.
bool sortcol( const vector <int> v1, const vector <int> v2)
{
return v1[0]<v2[0];
}
sort(ArrOfTimings.begin(), ArrOfTimings.end(), sortcol);
Is there any way possible to not make multiple functions but making it all work with one only.
Something like this
bool sortcol(int ind, const vector <int> v1, const vector <int> v2)
{
return v1[ind]<v2[ind];
}
sort(ArrOfTimings.begin(), ArrOfTimings.end(), sortcol(0));