#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> intVector;
template<class T, class A>
void ShowVector(const vector<T, A>& v);
int main()
{
intVector intValueVector;
cout << "intValueVector" << "\n";
ShowVector(intValueVector);
intVector intValueVector2(3);
cout << "intValueVector2(3)" << "\n";
ShowVector(intValueVector2);
intValueVector2.resize(5, 100);
cout << "intValueVector2 after resize(5, 100)\n";
ShowVector(intValueVector2);
intValueVector2.reserve(10);
cout << "intValueVector2 after reserve(10)\n";
ShowVector(intValueVector2);
return 0;
}
template<class T, class A>
void ShowVector(const vector<T, A>& v)
{
cout << "max_size() = " << v.max_size();
cout << "\tsize() = " << v.size();
cout << "\t" << (v.empty()? "empty": "not empty");
cout << "\tcapacity() = " << v.capacity();
cout << "\n\n";
}
|