X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e0e263e310c497d83a61b446bf1e9569e80fd14..1319b2684fe48d168282de7b6ce9a113a206d87e:/interface/wx/dynarray.h diff --git a/interface/wx/dynarray.h b/interface/wx/dynarray.h index b1808a7761..f9066994d6 100644 --- a/interface/wx/dynarray.h +++ b/interface/wx/dynarray.h @@ -3,7 +3,7 @@ // Purpose: interface of wxArray // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -32,7 +32,7 @@ functions are inline, so they do not take @e any space at all. wxWidgets has three different kinds of array. All of them derive from - wxBaseArray class which works with untyped data and can not be used + wxBaseArray class which works with untyped data and cannot be used directly. The standard macros WX_DEFINE_ARRAY(), WX_DEFINE_SORTED_ARRAY() and WX_DEFINE_OBJARRAY() are used to define a new class deriving from it. The classes declared will be called in this documentation wxArray, @@ -124,7 +124,7 @@ however dumb, C++ compiler in the world. Remember to include @ just before each - WX_DEFINE_OBJARRAY() ocurrence in your code, even if you have several in + WX_DEFINE_OBJARRAY() occurrence in your code, even if you have several in the same file. Things are much simpler for wxArray and wxSortedArray however: it is enough @@ -546,14 +546,20 @@ public: @code T *item = array[n]; + array.Remove(item); delete item; - array.Remove(n); @endcode See also WX_CLEAR_ARRAY() macro which deletes all elements of a wxArray (supposed to contain pointers). + + Notice that for sorted arrays this method uses binary search to find + the item so it doesn't necessarily remove the first matching item, but + the first one found by the binary search. + + @see RemoveAt() */ - Remove(T item); + void Remove(T item); /** Removes @a count elements starting at @a index from the array. When an @@ -571,7 +577,7 @@ public: See also WX_CLEAR_ARRAY() macro which deletes all elements of a wxArray (supposed to contain pointers). */ - RemoveAt(size_t index, size_t count = 1); + void RemoveAt(size_t index, size_t count = 1); //@} @@ -596,15 +602,16 @@ public: another, identical, element is in the array. */ int Index(T& item, bool searchFromEnd = false) const; + /** This version of Index() is for wxSortedArray only. - Searches the element in the array, starting from either beginning or - the end depending on the value of @a searchFromEnd parameter. + Searches for the element in the array, using binary search. + @c wxNOT_FOUND is returned if the element is not found, otherwise the index of the element is returned. */ - const int Index(T& item) const; + int Index(T& item) const; /** Search for a place to insert @a item into the sorted array (binary @@ -652,7 +659,7 @@ public: /** This macro may be used to delete all elements of the array before emptying - it. It can not be used with wxObjArrays - but they will delete their + it. It cannot be used with wxObjArrays - but they will delete their elements anyway when you call Empty(). */ #define WX_CLEAR_ARRAY(wxArray_arrayToBeCleared)