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
This commit is contained in:
Vadim Zeitlin
2008-11-29 22:28:44 +00:00
parent d9698bd4ac
commit 664e5ff93e
2 changed files with 28 additions and 0 deletions

View File

@@ -169,6 +169,22 @@ public:
wxVector() : m_size(0), m_capacity(0), m_values(NULL) {} 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) wxVector(const wxVector& c) : m_size(0), m_capacity(0), m_values(NULL)
{ {
Copy(c); Copy(c);

View File

@@ -64,6 +64,18 @@ public:
*/ */
wxVector(); 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. Copy onstructor.
*/ */