From 664e5ff93e8ed74969e67c79ce9da004309ca91c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Nov 2008 22:28:44 +0000 Subject: [PATCH] add wxVector(size_t size[, const value_type& value]) ctors git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/vector.h | 16 ++++++++++++++++ interface/wx/vector.h | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/wx/vector.h b/include/wx/vector.h index 64b37b9885..cf8e69c6e4 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(n); + 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); diff --git a/interface/wx/vector.h b/interface/wx/vector.h index ddaff2edca..a85825f258 100644 --- a/interface/wx/vector.h +++ b/interface/wx/vector.h @@ -64,6 +64,18 @@ public: */ wxVector(); + /** + Constructor initializing the vector with the given number of + default-constructed objects. + */ + wxVector(size_type size); + + /** + Constructor initializing the vector with the given number of + copies of the given object. + */ + wxVector(size_type size, const value_type& value); + /** Copy onstructor. */ -- 2.45.2