-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdequeue.cpp
More file actions
44 lines (34 loc) · 722 Bytes
/
Copy pathdequeue.cpp
File metadata and controls
44 lines (34 loc) · 722 Bytes
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
#include <iostream>
#include <deque>
using namespace std;
int main()
{
deque<int> d;
d.push_back(1);
d.push_front(2);
for (int i : d)
{
cout << i << " ";
}
cout << endl;
// d.pop_back();
// d.pop_front();
// for (int i : d)
// {
// cout << i << " ";
// }
// cout << endl;
cout << "First index element -> " << d.at(1) << endl;
cout << "Front -> " << d.front() << endl;
cout << "Back -> " << d.back() << endl;
cout << "Empty or not -> " << d.empty() << endl;
cout << "before erase -> " << d.size() << endl;
d.erase(d.begin(), d.begin() + 1);
cout << "after erase -> " << d.size() << endl;
for (int i : d)
{
cout << i << " ";
}
cout << endl;
return 0;
}