I have a problem with sorting a vector in a specific order.
As seen below I am putting 4 strings into a vector like this.
The result of the sorting that I am after is like this:
(Highest Value at the top and the Lowest Value at the Bottom)
20A
3A
-3A
-20A
But the Sort will be like below instead:
(It seems that the negativ values is Correct but not the positive as I want it)
3A
20A
-3A
-20A
I have also tried .begin .end as sort but this will also be wrong.
How could a sort like this be possible. Thanks !
std::vector<string> Sorting;
std::string One = "-20A";
std::string Two = "20A";
std::string Three = "-3A";
std::string Four = "3A";
Sorting.push_back(One);
Sorting.push_back(Two);
Sorting.push_back(Three);
Sorting.push_back(Four);
std::sort( Sorting.rbegin(), Sorting.rend() );