X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e82d270881b05d6243ec925f6f0e73914eb7edf..0dd9646ea8b9e6f3a5fa8c42b6a4954cf8e3a48d:/include/wx/vector.h?ds=sidebyside diff --git a/include/wx/vector.h b/include/wx/vector.h index 898a0cc399..056202bcaa 100644 --- a/include/wx/vector.h +++ b/include/wx/vector.h @@ -169,6 +169,22 @@ public: wxVector() : m_size(0), m_capacity(0), m_values(NULL) {} + wxVector(size_type size) + : m_size(0), m_capacity(0), m_values(NULL) + { + reserve(size); + for ( size_t n = 0; n < size; n++ ) + push_back(value_type()); + } + + wxVector(size_type size, const value_type& v) + : m_size(0), m_capacity(0), m_values(NULL) + { + reserve(size); + for ( size_t n = 0; n < size; n++ ) + push_back(v); + } + wxVector(const wxVector& c) : m_size(0), m_capacity(0), m_values(NULL) { Copy(c); @@ -230,8 +246,11 @@ public: wxVector& operator=(const wxVector& vb) { - clear(); - Copy(vb); + if (this != &vb) + { + clear(); + Copy(vb); + } return *this; }