X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc7665d447d8d8958f57c3384fc53c94d46140d5..f04f39918777d57176a2755a6e99206f21b2d13c:/include/wx/dynarray.h diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index c7d94ac6d4..58002387fd 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -172,6 +172,8 @@ public: \ { return (T&)(wxBaseArray::Item(uiIndex)); } \ T& Item(uint uiIndex) const \ { return (T&)(wxBaseArray::Item(uiIndex)); } \ + T& Last() const \ + { return (T&)(wxBaseArray::Item(Count() - 1)); } \ \ int Index(T Item, bool bFromEnd = FALSE) const \ { return wxBaseArray::Index((long)Item, bFromEnd); } \ @@ -184,7 +186,8 @@ public: \ void Remove(uint uiIndex) { wxBaseArray::Remove(uiIndex); } \ void Remove(T Item) \ { int iIndex = Index(Item); \ - wxCHECK( iIndex != NOT_FOUND ); \ + wxCHECK2_MSG( iIndex != NOT_FOUND, return, \ + "removing inexisting element in wxArray::Remove" ); \ wxBaseArray::Remove((uint)iIndex); } \ \ void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \ @@ -208,6 +211,8 @@ public: \ { return *(T*)wxBaseArray::Item(uiIndex); } \ T& Item(uint uiIndex) const \ { return *(T*)wxBaseArray::Item(uiIndex); } \ + T& Last() const \ + { return *(T*)(wxBaseArray::Item(Count() - 1)); } \ \ int Index(const T& Item, bool bFromEnd = FALSE) const; \ \