I have a vector of following type:
std::vector< std::pair< std::pair< int, int >, std::vector > > neighbors;
I
Lambdas:
std::sort(
neighbors.begin(),
neighbors.end(),
[index](const std::pair< std::pair< int, int >, std::vector > &a,
const std::pair< std::pair< int, int >, std::vector > &b)
{
return ( a.second[index] > b.second[index] );
}
);
See What is a lambda expression in C++11? for a detailled introduction.