-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvector.cpp
More file actions
57 lines (51 loc) · 1.17 KB
/
vector.cpp
File metadata and controls
57 lines (51 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include"vector.h"
// Iterator begin();
// Iterator end();
// int size();
// check int capacity();
// updated void resize(int);
// checked bool empty();
// updated void shrink_to_fit();
// updated void reserve(int);
// updated T* back();
// updated T* front();
// updated void assign(int,T*);
// check void push_back(T);
// updated void pop_back();
// updated T* insert(int,T);
// updated T* insert(int,int,T);
// updated void erase(int);
// updated void swap(T*);
// updated void clear();
// //T* emplace();
// T* operator ++();
// void display();
// T& operator[](int);
int main()
{
vector<int> vec,vec2;
vec.push_back(5);
vec.push_back(7);
vec.push_back(34);
vec.push_back(5);
vec.push_back(5);
vec.push_back(34);
vec2.push_back(4);
vec2.push_back(5);
vec2.push_back(74);
vec2.push_back(1);
vec2.push_back(0);
vec2.push_back(4);
//vector<int>::Iterator itr;
//itr=vec.begin();
// cout<<vec.size();
// for(int i=0;i<vec.size();i++)
// cout<<vec[i]<<endl;
vec.display();
vec2.display();
cout<<"\nSize="<<vec.size()<<" Capacity="<<vec.capacity();
vec.swap(vec2);
vec.display();
vec2.display();
cout<<"\nSize="<<vec.size()<<" Capacity="<<vec.capacity();
}