X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4a980f4f57a4e7eea00c55cbb3d139f97d90c20..3056dddc5438f7273ac6c75d8396520cd798812c:/include/wx/dynarray.h?ds=sidebyside diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index d94afc572e..6dabfa5b2b 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -120,6 +120,10 @@ classexp name : public std::vector \ public: \ typedef wxArray_SortFunction::CMPFUNC CMPFUNC; \ public: \ + name() : std::vector() { } \ + name(size_type n) : std::vector(n) { } \ + name(size_type n, const_reference v) : std::vector(n, v) { } \ + \ void Empty() { clear(); } \ void Clear() { clear(); } \ void Alloc(size_t uiSize) { reserve(uiSize); } \ @@ -282,6 +286,10 @@ typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \ classexp name : public base \ { \ public: \ + name() : base() { } \ + name(size_type n) : base(n) { } \ + name(size_type n, const_reference v) : base(n, v) { } \ + \ T& operator[](size_t uiIndex) const \ { return (T&)(base::operator[](uiIndex)); } \ T& Item(size_t uiIndex) const \ @@ -326,11 +334,6 @@ public: \ name() { } \ ~name() { } \ \ - name& operator=(const name& src) \ - { base* temp = (base*) this; \ - (*temp) = ((const base&)src); \ - return *this; } \ - \ T& operator[](size_t uiIndex) const \ { return (T&)(base::operator[](uiIndex)); } \ T& Item(size_t uiIndex) const \ @@ -438,6 +441,7 @@ public: \ bool operator !=(const itor& it) const { return m_ptr != it.m_ptr; }\ }; \ \ + name(size_type n) { assign(n, value_type()); } \ name(size_type n, const_reference v) { assign(n, v); } \ name(const_iterator first, const_iterator last) \ { assign(first, last); } \ @@ -472,7 +476,7 @@ public: \ const_reverse_iterator rbegin() const; \ reverse_iterator rend() { return reverse_iterator(begin() - 1); } \ const_reverse_iterator rend() const; \ - void reserve(size_type n) { base::reserve(n); }; \ + void reserve(size_type n) { base::reserve(n); } \ void resize(size_type n, value_type v = value_type()) \ { base::resize(n, v); } \ } @@ -557,7 +561,8 @@ public: \ \ ~name(); \ \ - void Alloc(size_t count) { reserve(count); } \ + void Alloc(size_t count) { base::reserve(count); } \ + void reserve(size_t count) { base::reserve(count); } \ size_t GetCount() const { return base_array::size(); } \ size_t size() const { return base_array::size(); } \ bool IsEmpty() const { return base_array::empty(); } \ @@ -1006,7 +1011,7 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE #define WX_PREPEND_ARRAY(array, other) \ { \ size_t wxAAcnt = (other).size(); \ - (array).Alloc(wxAAcnt); \ + (array).reserve(wxAAcnt); \ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ { \ (array).Insert((other)[wxAAn], wxAAn); \ @@ -1017,7 +1022,7 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE #define WX_APPEND_ARRAY(array, other) \ { \ size_t wxAAcnt = (other).size(); \ - (array).Alloc(wxAAcnt); \ + (array).reserve(wxAAcnt); \ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \ { \ (array).push_back((other)[wxAAn]); \