moving sort()/order() functionality into VectorVal

This commit is contained in:
Vern Paxson 2021-02-24 18:09:40 -08:00
parent 0299ea0894
commit 13e7ba3a00
3 changed files with 194 additions and 126 deletions

View file

@ -1354,10 +1354,18 @@ public:
bool Remove(unsigned int index);
/**
* Sorts the vector in place, using the given comparison function.
* Sorts the vector in place, using the given optional
* comparison function.
* @param cmp_func Comparison function for vector elements.
*/
void Sort(bool cmp_func(const ValPtr& a, const ValPtr& b));
void Sort(Func* cmp_func = nullptr);
/**
* Returns a "vector of count" holding the indices of this
* vector when sorted using the given (optional) comparison function.
* @param cmp_func Comparison function for vector elements.
*/
VectorValPtr Order(Func* cmp_func = nullptr);
protected:
void ValDescribe(ODesc* d) const override;