#include#include int main() { std::deque mydeque = {10, 20, 30, 40, 50}; std::cout << "Deque before pop_front:"; for (auto i : mydeque) { std::cout << ' ' << i; } std::cout << '\n'; mydeque.pop_front(); std::cout << "Deque after pop_front:"; for (auto i : mydeque) { std::cout << ' ' << i; } std::cout << '\n'; return 0; }
Deque before pop_front: 10 20 30 40 50 Deque after pop_front: 20 30 40 50In this example, we create a deque of integers with 5 elements. We print the deque before removing the front element using the pop_front function. Then, we remove the front element, and print the deque again. The package library used in this example is the standard library of C++, which provides the std deque container and its member functions, including pop_front.