MCPcopy Create free account
hub / github.com/comaps/comaps / PrintTop

Function PrintTop

generator/statistics.cpp:198–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196
197template <class TSortCr, class TSet>
198void 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
214struct greater_size
215{

Callers

nothing calls this directly

Calls 5

PrintInfoFunction · 0.85
GetKeyFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected