/* * size(): how many elements the vector currently contains * capacity(): how many elements it could contain without reallocation * max_size(): the maximum theoretical size */ #include #include #include using namespace std; int main() { vector v; for (int i=0; i<10; i++) { v.push_back(i*i); cout << "size=" << v.size() << ' ' << "capacity=" << v.capacity() << ' ' << "max_size=" << v.max_size() << '\n'; } return 0; }