I've seen that a vector can be sorted using
vector<double> V;
vector<int> Index;
V.push_back(9);
V.push_back(10);
V.push_back(8);
Index.push_back(0);
Index.push_back(1);
Index.push_back(2);
sort(V.begin(), V.end());
If I want to sort Index according to how V was sorted, there is an optional third parameter to sort() that will do this. I don't understand how to specify this third parameter. I saw an example that defined an iterator, but that was for sorting a fancier class than just doubles.
Can someone point me in the right direction?
Thanks!
David