---
description: Doubly Ended Queue (Deque)
---

# STL Deque

* [ ] Push and pop operations are Possible on both sides in deque.
* [x] Stack and Queue Implementation can also be done deque.

<details>

<summary>Deque using STL</summary>

```cpp
#include <iostream>
#include <queue>
using namespace std;

int main() {
    deque<int> de;

    de.push_front(444);
    de.push_back(555);

    cout << de.front() << "\n";
    cout << de.back() << "\n";

    de.pop_front(); // 444 removed

    cout << de.front() << "\n";
    cout << de.back() << "\n";
    
    de.pop_front(); // 555 removed

    if (de.empty()) {
        cout << "Empty Queue!" << "\n";
    }
    else{
        cout << "Queue isn't empty" << "\n";
    }
}
```

</details>
