From 8161cf19e9feb0f40618e2d593ef1ae56e105a77 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 23 Jun 2014 01:08:44 +0000 Subject: [PATCH] Change wxStringSort{As,De}cending() to use references, not pointers. This is more convenient to use and makes more sense as the arguments are never null. See #16330. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76750 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/arrstr.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/wx/arrstr.h b/include/wx/arrstr.h index 83af3fbac0..3877ba158e 100644 --- a/include/wx/arrstr.h +++ b/include/wx/arrstr.h @@ -17,12 +17,12 @@ // these functions are only used in STL build now but we define them in any // case for compatibility with the existing code outside of the library which // could be using them -inline int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2) +inline int wxCMPFUNC_CONV wxStringSortAscending(const wxString& s1, const wxString& s2) { - return s1->Cmp(*s2); + return s1.Cmp(s2); } -inline int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2) +inline int wxCMPFUNC_CONV wxStringSortDescending(const wxString& s1, const wxString& s2) { return wxStringSortAscending(s2, s1); } @@ -38,9 +38,6 @@ _WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase, class WXDLLIMPEXP_BASE); WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, wxBaseArrayStringBase, WXDLLIMPEXP_BASE); -_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, - wxBaseArrayStringBase, = wxStringSortAscending, - class WXDLLIMPEXP_BASE, CMPFUNCwxString); class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase { @@ -68,6 +65,10 @@ public: } }; +_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, + wxBaseArrayStringBase, = wxStringSortAscending, + class WXDLLIMPEXP_BASE, wxArrayString::CompareFunction); + class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase { public: