I have a vector of following type:
std::vector< std::pair< std::pair< int, int >, std::vector<float> > > neighbors;
I would like to create sort the following vector as follows
std::sort( neighbors.begin(), neighbors.end(), myFunc(index) );
where,
bool myFunc( const std::pair< std::pair< int, int >, float > &a, const std::pair< std::pair< int, int >, float > &b, const int index ){
return ( a.second[index] > b.second[index] );
}
I know that the syntax is wrong but I wish to provide an index for comparing only that element of the vector.
I am not sure how to pass this argument to myFunc.