+#define _WX_DEFINE_SORTED_ARRAY(T, name, classexp) \
+typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2); \
+classexp name : public wxBaseArray \
+{ \
+public: \
+ name(SCMPFUNC##T fn) \
+ { size_t type = sizeof(T); \
+ size_t sizelong = sizeof(long); \
+ if ( type > sizelong ) \
+ { wxFAIL_MSG( _WX_ERROR_SIZEOF ); } \
+ m_fnCompare = fn; \
+ } \
+ \
+ name& operator=(const name& src) \
+ { wxBaseArray* temp = (wxBaseArray*) this; \
+ (*temp) = ((const wxBaseArray&)src); \
+ m_fnCompare = src.m_fnCompare; \
+ return *this; } \
+ \
+ T& operator[](size_t uiIndex) const \
+ { return (T&)(wxBaseArray::Item(uiIndex)); } \
+ T& Item(size_t uiIndex) const \
+ { return (T&)(wxBaseArray::Item(uiIndex)); } \
+ T& Last() const \
+ { return (T&)(wxBaseArray::Item(Count() - 1)); } \
+ \
+ int Index(T Item) const \
+ { return wxBaseArray::Index((long)Item, (CMPFUNC)m_fnCompare); }\
+ \
+ size_t IndexForInsert(T Item) const \
+ { return wxBaseArray::IndexForInsert((long)Item, \
+ (CMPFUNC)m_fnCompare); } \
+ \
+ void AddAt(T item, size_t index) \
+ { wxBaseArray::Insert((long)item, index); } \
+ \
+ void Add(T Item) \
+ { wxBaseArray::Add((long)Item, (CMPFUNC)m_fnCompare); } \
+ \
+ void RemoveAt(size_t uiIndex) { wxBaseArray::RemoveAt(uiIndex); } \
+ void Remove(T Item) \
+ { int iIndex = Index(Item); \
+ wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \
+ _WX_ERROR_REMOVE ); \
+ wxBaseArray::RemoveAt((size_t)iIndex); } \
+ \
+private: \
+ SCMPFUNC##T m_fnCompare; \
+}
+
+// ----------------------------------------------------------------------------
+// see WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY
+// ----------------------------------------------------------------------------
+#define _WX_DECLARE_OBJARRAY(T, name, classexp) \