diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 67dc5e6f5e..03cb8c6c1f 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -255,6 +255,9 @@ public: Add(item); } +protected: + SCMPFUNC GetCompareFunction() const wxNOEXCEPT { return m_fnCompare; } + private: SCMPFUNC m_fnCompare; }; diff --git a/src/common/arrstr.cpp b/src/common/arrstr.cpp index 3aac42f67d..3611bc4276 100644 --- a/src/common/arrstr.cpp +++ b/src/common/arrstr.cpp @@ -198,15 +198,16 @@ int wxSortedArrayString::Index(const wxString& str, wxASSERT_MSG( bCase && !bFromEnd, "search parameters ignored for sorted array" ); + SCMPFUNC function = GetCompareFunction(); wxSortedArrayString::const_iterator it = std::lower_bound(begin(), end(), str, #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 - wxStringCompare(wxStringCmp()) + wxStringCompare(function) #endif // C++11/C++98 );