I have a class that defined as
class chromosome
{
vector<vector <int> > P(3,vector <int> (5,0));
vector<int> F;
}
I want to sort F in descending order, and the P corresponding with F will be sorted. For example, Before sort
P F
101 4
111 8
001 2
110 5
100 3
After sort
P F
111 8
110 5
101 4
100 3
001 2
How to implelement it by C++. I tried to used sort function in vector class. However, it only sort F. The P order is not change This is my code
std::sort(F.rbegin(),F.rend());