| 196 | |
| 197 | template <class TSortCr, class TSet> |
| 198 | void PrintTop(std::ostream & os, char const * prefix, TSet const & theSet, uint8_t prefixWidth = 5, bool names = false) |
| 199 | { |
| 200 | os << "\n" << prefix << "\n"; |
| 201 | |
| 202 | std::vector<std::pair<typename TSet::key_type, typename TSet::mapped_type>> vec(theSet.begin(), theSet.end()); |
| 203 | |
| 204 | sort(vec.begin(), vec.end(), TSortCr()); |
| 205 | |
| 206 | size_t const count = std::min(static_cast<size_t>(20), vec.size()); |
| 207 | for (size_t i = 0; i < count; ++i) |
| 208 | { |
| 209 | os << std::setw(2) << i << ". "; |
| 210 | PrintInfo(os, GetKey(vec[i].first), vec[i].second, prefixWidth, names); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | struct greater_size |
| 215 | { |