#include<iostream>
using namespace std;
#include<vector>
#include "s.h"
template<class T>
void f(vector<T> a)
{
cout << "size " << a.size() << endl;
cout << "capacity " << a.capacity() << endl << endl;
}
int main()
{
vector<int> s(10,5);
f(s);
s.resize(50);
f(s);
s.reserve(150);
f(s);
return 0;
}
I think resize() changes size, and reserve() changes capacity, but in my example reserve() don't change capasity, why? And my second question-what is the meaning assign()? can i do the same with operator=()?
// 10 10
// 50 50
// 50 50