I want to use the stl sort algorithm to sort some numbers, but i also want to remember their initial position. I have a data structure like this:
struct Numbers {
int position;
int value;
};
I have created a vector of Numbers like this:
vector<Numbers> a;
How to use the stl sort algorithm, such that i sort the data structures based on the value?