#include #include #include using namespace std; template void print(T& v) { for (T::iterator v_iter = v.begin(); v_iter != v.end(); v_iter++) { cout << *v_iter << " "; } cout << endl; } void main() { vector v1(10); // reserve 10 places and fill with int() (that is, default value for value type) vector v2(10,1); // reserve 10 places and fill with 1 print(v2); v2.insert(v2.begin() + v2.size()/2, v1.begin(), v1.end()); // insert copy of v1 into middle of v2 print(v2); v2.erase(v2.begin(), v2.begin() + v2.size()/2); // erase first half of v2 print(v2); }