20 #ifndef TESSERACT_CCUTIL_SORTHELPER_H_
21 #define TESSERACT_CCUTIL_SORTHELPER_H_
65 for (
int i = 0; i < counts_.size(); ++i) {
66 if (counts_[i].value == value) {
67 counts_[i].count +=
count;
80 for (
int i = 0; i < counts_.size(); ++i) {
81 if (counts_[i].
count > best_count) {
82 best_count = counts_[i].count;
83 if (max_value !=
NULL)
84 *max_value = counts_[i].value;
106 #endif // TESSERACT_CCUTIL_SORTHELPER_H_.
static int SortPairsByValue(const void *v1, const void *v2)
const GenericVector< SortPair< T > > & SortByCount()
int MaxCount(T *max_value) const
const GenericVector< SortPair< T > > & SortByValue()
void Add(T value, int count)
static int SortPairsByCount(const void *v1, const void *v2)