+template<typename T>
+inline void wxVectorSort(wxVector<T>& v)
+{
+ std::sort(v.begin(), v.end());
+}
+
+#else // !wxUSE_STD_CONTAINERS
+
+#include "wx/scopeguard.h"
+#include "wx/meta/movable.h"
+#include "wx/meta/if.h"
+
+#include "wx/beforestd.h"
+#include <new> // for placement new
+#include "wx/afterstd.h"
+
+// wxQsort is declared in wx/utils.h, but can't include that file here,
+// it indirectly includes this file. Just lovely...
+typedef int (*wxSortCallback)(const void* pItem1,
+ const void* pItem2,
+ const void* user_data);
+WXDLLIMPEXP_BASE void wxQsort(void* pbase, size_t total_elems,
+ size_t size, wxSortCallback cmp,
+ const void* user_data);
+
+namespace wxPrivate
+{
+
+// These templates encapsulate memory operations for use by wxVector; there are
+// two implementations, both in generic way for any C++ types and as an
+// optimized version for "movable" types that uses realloc() and memmove().
+
+// version for movable types:
+template<typename T>
+struct wxVectorMemOpsMovable
+{
+ static void Free(T* array)
+ { free(array); }
+
+ static T* Realloc(T* old, size_t newCapacity, size_t WXUNUSED(occupiedSize))
+ { return (T*)realloc(old, newCapacity * sizeof(T)); }