+ wxString& operator[](size_t nIndex) const;
+};
+
+
+/**
+ @class wxSortedArrayString
+ @wxheader{arrstr.h}
+
+ wxSortedArrayString is an efficient container for storing wxString objects
+ which always keeps the string in alphabetical order.
+
+ wxSortedArrayString uses binary search in its wxArrayString::Index() function
+ (instead of linear search for wxArrayString::Index()) which makes it much more
+ efficient if you add strings to the array rarely (because, of course, you have
+ to pay for Index() efficiency by having Add() be slower) but search for them
+ often. Several methods should not be used with sorted array (basically, all
+ those which break the order of items) which is mentioned in their description.
+
+ @todo what about STL? who does it integrates?
+
+ @library{wxbase}
+ @category{containers}
+
+ @see wxArray, wxString, @ref overview_string
+*/
+class wxSortedArrayString : public wxArrayString
+{
+public:
+
+ /**
+ Copy constructor. Note that when an array is assigned to a sorted array,
+ its contents is automatically sorted during construction.
+ */
+ wxArrayString(const wxArrayString& array);
+
+ /**
+ @copydoc wxArrayString::Add()
+
+ @warning
+ For sorted arrays, the index of the inserted item will not be, in general,
+ equal to GetCount() - 1 because the item is inserted at the correct position
+ to keep the array sorted and not appended.
+ */
+ size_t Add(const wxString& str, size_t copies = 1);
+
+
+ /**
+ @copydoc wxArrayString::Index()
+
+ This function uses binary search for wxSortedArrayString, but it ignores
+ the @a bCase and @a bFromEnd parameters.
+ */
+ int Index(const wxString& sz, bool bCase = true,
+ bool bFromEnd = false);
+
+ /**
+ @warning this function should not be used with sorted arrays because it
+ could break the order of items and, for example, subsequent calls
+ to Index() would then not work!
+ */
+ void Insert(const wxString& str, size_t nIndex,
+ size_t copies = 1);
+
+ //@{
+ /**
+ @warning this function should not be used with sorted array because it could
+ break the order of items and, for example, subsequent calls to Index()
+ would then not work! Also, sorting a wxSortedArrayString doesn't make
+ sense because its elements are always already sorted.
+ */
+ void Sort(bool reverseOrder = false);
+ void Sort(CompareFunction compareFunction);
+ //@}