27 std::vector<std::pair<T, unsigned int>> result;
28 result.reserve(counts.size());
29 for (
const auto &[key, count] : counts) {
30 result.emplace_back(key, count);
34 std::sort(result.begin(), result.end(), [](
const auto &a,
const auto &b) { return a.second > b.second; });
std::vector< std::pair< T, unsigned int > > counts_to_descending_list(const std::map< T, unsigned int > &counts)
Converts a map of counts to a sorted vector of key-count pairs.