To sort the structure using std::sort function you need the bool type comparison function. By default it is for ascending order and for one value only.
Suppose you have structure:
struct data{int a,b,c;}
And you want to sort the structure in Descending order of value c. So you boolean function cmp will be:
bool cmp (data x, data y) {if(x.c > y.c) return true;else return false;}
You can also write it directly as:
bool cmp(data x, data y) {return x.c > y.c;