X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/38723be1d50facc0176455b69b409dcd457ac07a..f203de0cc435ab836505ad32b88cda5dc318db68:/include/wx/vector.h diff --git a/include/wx/vector.h b/include/wx/vector.h index 777ee949a5..982cd08626 100644 --- a/include/wx/vector.h +++ b/include/wx/vector.h @@ -17,6 +17,8 @@ #if wxUSE_STL #include +#include + #define wxVector std::vector template inline void wxVectorSort(wxVector& v) @@ -446,22 +448,26 @@ inline typename wxVector::size_type wxVector::erase(size_type n) namespace wxPrivate { - // This function is a helper for the wxVectorSort function, and should - // not be used directly in user's code. +// This is a helper for the wxVectorSort function, and should not be used +// directly in user's code. template -int wxVectorSort_compare(const void* pitem1, const void* pitem2, const void* ) +struct wxVectorSort { - const T& item1 = *reinterpret_cast(pitem1); - const T& item2 = *reinterpret_cast(pitem2); - - if (item1 < item2) - return -1; - else if (item2 < item1) - return 1; - else - return 0; -} + static int wxCMPFUNC_CONV + Compare(const void* pitem1, const void* pitem2, const void* ) + { + const T& item1 = *reinterpret_cast(pitem1); + const T& item2 = *reinterpret_cast(pitem2); + + if (item1 < item2) + return -1; + else if (item2 < item1) + return 1; + else + return 0; + } +}; } // namespace wxPrivate @@ -471,7 +477,7 @@ template void wxVectorSort(wxVector& v) { wxQsort(v.begin(), v.size(), sizeof(T), - wxPrivate::wxVectorSort_compare, NULL); + wxPrivate::wxVectorSort::Compare, NULL); }