Dynamically allocated vector begins with 0 elements : vector definition « vector « C++ Tutorial






#include <iostream>
#include <vector>

using namespace std;
typedef vector<int> INTVECTOR;

int main(void)
{
   // Dynamically allocated vector begins with 0 elements.
   INTVECTOR theVector;

   theVector.push_back(42);

   // Show statistics about vector.
   cout << "theVector's size is: " << theVector.size() << endl;
   cout << "theVector's maximum size is: " << theVector.max_size()<< endl;
   cout << "theVector's capacity is: " << theVector.capacity() << endl;

}








16.11.vector definition
16.11.1.Using a Vector of Booleans
16.11.2.vector declaration
16.11.3.vector of 10 strings
16.11.4.Dynamically allocated vector begins with 0 elements
16.11.5.vector's copy constructor