Sorting a vector of pairs
Heyho,
i have a question about sorting a vector of pairs:
std::vector<std::pair<double,Processor*>> baryProc;
this vector is already filled up with the pairs. Now i wanted to sort the
pairs inside the vector based on the double value inside the pair
EXAMPLE:
suppose i have 3 pairs inside the vector. pair1 is at front and pair 3 is
at end. pair2 is in the middle:
pair1(1, proc1)
pair2(3, proc2)
pair3(2.5, proc3)
now i want to sort the pairs based on the double value. So that the order
inside the vector is:
pair1(1, proc1)
pair3(2.5, proc3)
pair2(3, proc2)
How could i do this? I am quite stucked.
Thanks for the help
No comments:
Post a Comment