If I have a vector of pairs
std::vector<std::pair<int, int> > vec;
is there and easy way to sort the list in increasing order based on the second element of the pair?
I know I can write a little function object that will do the work, but is there a way to use existing parts of the STL and std::less to do the work directly?
EDIT: I understand that I can write a separate function or class to pass to the third argument to sort. The question is whether or not I can build it out of standard stuff. I'd really something that looks like
std::sort(vec.begin(), vec.end(), std::something_magic<int, int, std::less>());