Fex search in wxSortedArrayString with custom compare function in STL build
This commit is contained in:
@@ -255,6 +255,9 @@ public:
|
|||||||
Add(item);
|
Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SCMPFUNC GetCompareFunction() const wxNOEXCEPT { return m_fnCompare; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SCMPFUNC m_fnCompare;
|
SCMPFUNC m_fnCompare;
|
||||||
};
|
};
|
||||||
|
@@ -198,15 +198,16 @@ int wxSortedArrayString::Index(const wxString& str,
|
|||||||
wxASSERT_MSG( bCase && !bFromEnd,
|
wxASSERT_MSG( bCase && !bFromEnd,
|
||||||
"search parameters ignored for sorted array" );
|
"search parameters ignored for sorted array" );
|
||||||
|
|
||||||
|
SCMPFUNC function = GetCompareFunction();
|
||||||
wxSortedArrayString::const_iterator
|
wxSortedArrayString::const_iterator
|
||||||
it = std::lower_bound(begin(), end(), str,
|
it = std::lower_bound(begin(), end(), str,
|
||||||
#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14)
|
#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14)
|
||||||
[](const wxString& s1, const wxString& s2)
|
[function](const wxString& s1, const wxString& s2)
|
||||||
{
|
{
|
||||||
return s1 < s2;
|
return function(s1, s2) < 0;
|
||||||
}
|
}
|
||||||
#else // C++98 version
|
#else // C++98 version
|
||||||
wxStringCompare(wxStringCmp())
|
wxStringCompare(function)
|
||||||
#endif // C++11/C++98
|
#endif // C++11/C++98
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user