The examples below come from the answer by Steven Stadnicki in Determining Poker Hands
Suppose a player get a hand like A9772. I would like to store the hand as either 77A92 or, better yet, 7A927. A hand of two pair would be stored with the higher of the two pairs first, then the lower, then the 'kicker' (so, e.g., A9977 would store as 97A97). Three of a kind would be stored with one card of the three first, then the kickers, then the other cards (e.g., A7772 would be 7A277); a full house would be stored with one of its three and then one of its two (e.g., 99777 would be stored as 79779);
How can I do that? Suppose I have a vector of cards :
std::vector<Card> m_cards;
Or simpler a vector of int
std::vector<int> v = {3, 9, 7, 7, 2};
The goal is to sort the above vector as follows: 77932.