Fix sorting in generic wxDataViewCtrl broken by recent changes

The comparator used with std::sort() must return true only if the first
item is strictly less than the second one, this is a requirement of the
sorting algorithm and not respecting it results in wrong final order.

See https://github.com/wxWidgets/wxWidgets/pull/642
This commit is contained in:
Daniel Kulp
2018-01-24 23:40:36 +01:00
committed by Vadim Zeitlin
parent 9b51ef82af
commit d8b3fc84c2

View File

@@ -1666,12 +1666,11 @@ public:
m_sortOrder.IsAscending());
}
// Return true if the items are in order, i.e. the first item is less than
// or equal (because it's useless to exchange them in this case) than the
// second one. This is used by std::sort().
// Return true if the items are (strictly) in order, i.e. the first item is
// less than the second one. This is used by std::sort().
bool operator()(wxDataViewTreeNode* first, wxDataViewTreeNode* second) const
{
return Compare(first, second) <= 0;
return Compare(first, second) < 0;
}
private: