#include using namespace std; int main() { int arr1[5] = {1, 2, 3, 4, 5}; vector v1(arr1, arr1 + 5); cout << "size: " << v1.size() << endl; cout << "capacity: " << v1.capacity() << endl; cout << "first addr: " << &v1[0] << endl; v1.resize(20); // 重新指定容器的长度 cout << "size: " << v1.size() << endl; cout << "capacity: " << v1.capacity() << endl; // 调整前后首地址会发生变化 cout << "first addr: " << &v1[0] << endl; return 0; }