#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<string> svec;
string word;
while (cin >> word) {
svec.push_back(word);
}
cout << "size == " << svec.size() << endl
<< "capacity == " << svec.capacity() << endl;
svec.shrink_to_fit();
cout << "size == " << svec.size() << endl
<< "capacity == " << svec.capacity() << endl;
return 0;
}
shrink_to_fit() demo
最新推荐文章于 2022-04-12 21:06:32 发布