35 #ifndef __H__SORT_UTIL__
36 #define __H__SORT_UTIL__
41 template<
typename TIndex,
typename TValue>
68 template<
typename TCompareValues,
bool bReverse>
74 template<
typename TIndex>
86 template<
typename TCompareValues,
typename TCompare>
92 template<
typename TIndex>
113 template<
typename TCompareValues>
119 template<
typename TCompareValues>
128 template<
typename TCompareValues,
typename TCompare>
144 template<
typename TCompareValues>
145 void GetSortedIndices(std::vector<size_t> &indices,
const TCompareValues &values,
bool bReverse=
false)
147 indices.resize(values.size());
148 for(
size_t i=0; i<indices.size(); i++) indices[i] = i;
164 template<
typename TCompareValues,
typename TCompare>
165 void GetSortedIndices(std::vector<size_t> &indices,
const TCompareValues &values, TCompare comp)
167 indices.resize(values.size());
168 for(
size_t i=0; i<indices.size(); i++) indices[i] = i;
172 template<
typename TCompareValues,
typename TCompare>
175 std::vector<size_t> indices(values.size());
180 template<
typename TCompareValues>
183 std::vector<size_t> indices(values.size());
192 return strcmp(a, b) < 0;
197 return strcmp(a, b) > 0;
Definition: sort_util.h:88
const TCompareValues & m_compareValues
Definition: sort_util.h:98
bool operator()(const TIndex &i, const TIndex &j) const
Definition: sort_util.h:93
CompareIndicesByClass2(const TCompareValues &compareValues, TCompare comp)
Definition: sort_util.h:90
TCompare m_comp
Definition: sort_util.h:99
Definition: sort_util.h:70
CompareIndicesByClass(const TCompareValues &compareValues)
Definition: sort_util.h:72
const TCompareValues & m_compareValues
Definition: sort_util.h:83
bool operator()(const TIndex &i, const TIndex &j) const
Definition: sort_util.h:75
CompareIndicesByClass< TCompareValues, false > CompareIndicesBy(const TCompareValues &values)
Definition: sort_util.h:114
bool boolstrcmpReversed(const char *a, const char *b)
Definition: sort_util.h:195
void GetSortedIndices(std::vector< size_t > &indices, const TCompareValues &values, bool bReverse=false)
Definition: sort_util.h:145
bool boolstrcmp(const char *a, const char *b)
Definition: sort_util.h:190
CompareIndicesByClass< TCompareValues, true > CompareIndicesReversedBy(const TCompareValues &values)
Definition: sort_util.h:120
Definition: sort_util.h:43
SortStruct()
Definition: sort_util.h:44
TIndex index
Definition: sort_util.h:62
TValue & get_value()
Definition: sort_util.h:52
SortStruct(TIndex &i, TValue &v)
Definition: sort_util.h:45
void set_value(TValue &val)
Definition: sort_util.h:47
TValue value
Definition: sort_util.h:63
bool operator<(const SortStruct< TIndex, TValue > &other) const
Definition: sort_util.h:57