#include #include #include using namespace std; int main() { vector v1; //born empty, but we can insert int's later vector v2(3); //born containing 0, 0, 0 vector v3(3, 10); //born containing 10, 10, 10 const int a[] = {10, 20, 30}; const size_t n = sizeof a / sizeof a[0]; vector v4(a, a + n); //born containing 10, 20, 30 vector v5 = v4; //born containing 10, 20, 30: copy constructor cout << "v5.empty() == " << v5.empty() << "\n" << "v5.size() == " << v5.size() << "\n" << "v5.capacity() == " << v5.capacity() << "\n\n"; cout << v5[1] << "\n"; //cout << v5.operator[](1) << "\n"; v5[1] = 21; //Change the 20 to 21: v5.operator[](1) = 21; cout << v5[1] << "\n"; //cout << v5.operator[](1) << "\n"; if (v3 < v4) { //Compare two vectors: if (operator<(v3, v4)) { v1 = v5; //assignment: v1.operator=(v5); } return EXIT_SUCCESS; }