+// WX_DEFINE_SORTED_ARRAY: this is the same as the previous macro, but it
+// defines a sorted array.
+//
+// Differences:
+// 1) it must be given a COMPARE function in ctor which takes 2 items of type
+// T* and should return -1, 0 or +1 if the first one is less/greater
+// than/equal to the second one.
+// 2) the Add() method inserts the item in such was that the array is always
+// sorted (it uses the COMPARE function)
+// 3) it has no Sort() method because it's always sorted
+// 4) Index() method is much faster (the sorted arrays use binary search
+// instead of linear one), but Add() is slower.
+// 5) there is no Insert() method because you can't insert an item into the
+// given position in a sorted array but there is IndexForInsert()/AddAt()
+// pair which may be used to optimize a common operation of "insert only if
+// not found"
+//
+// Note that you have to specify the comparison function when creating the
+// objects of this array type. If, as in 99% of cases, the comparison function
+// is the same for all objects of a class, WX_DEFINE_SORTED_ARRAY_CMP below is
+// more convenient.
+//
+// Summary: use this class when the speed of Index() function is important, use
+// the normal arrays otherwise.
+// ----------------------------------------------------------------------------
+
+#define wxARRAY_EMPTY_CMP
+
+#define WX_DEFINE_SORTED_ARRAY(T, name) \
+ WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, wxARRAY_DEFAULT_EXPORT)
+
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \
+ WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, WXDLLEXPORT)
+
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode) \
+ typedef T _wxArray##name; \
+ _WX_DEFINE_SORTED_ARRAY(_wxArray##name, name, wxARRAY_EMPTY_CMP, class expmode)
+
+// ----------------------------------------------------------------------------
+// WX_DEFINE_SORTED_ARRAY_CMP: exactly the same as above but the comparison
+// function is provided by this macro and the objects of this class have a
+// default constructor which just uses it.
+//
+// The arguments are: the element type, the comparison function and the array
+// name
+//
+// NB: this is, of course, how WX_DEFINE_SORTED_ARRAY() should have worked from
+// the very beginning - unfortunately I didn't think about this earlier :-(
+// ----------------------------------------------------------------------------
+
+#define WX_DEFINE_SORTED_ARRAY_CMP(T, cmpfunc, name) \
+ WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP(T, cmpfunc, name, \
+ wxARRAY_DEFAULT_EXPORT)