#include #include #include using namespace std; int main() { const int a[] = {10, 20, 30}; const size_t n = sizeof a / sizeof a[0]; vector v(a, a + n); //born containing 10, 20, 30 cout << "v.size() == " << v.size() << ", v.capacity() == " << v.capacity() << "\n"; v.reserve(7); //Prevent the push_back's from increasing the capacity. cout << "v.size() == " << v.size() << ", v.capacity() == " << v.capacity() << "\n"; v.push_back(40); v.push_back(50); v.push_back(60); v.push_back(70); cout << "v.size() == " << v.size() << ", v.capacity() == " << v.capacity() << "\n"; return EXIT_SUCCESS; }