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
This commit is contained in:
Vadim Zeitlin
2014-06-23 01:08:44 +00:00
parent a15a949c30
commit 8161cf19e9

View File

@@ -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: