#include <deque> // std::deque<>
#include <iostream> // std::cout, std::endl
int main()
{
// Create a deque (double ended queue)
std::deque<int> deq;
// Use the keyword push_back to add element at the end
int element1 = 10;
deq.push_back(element1);
// Use the keyword push_front to insert element at beginning
int element2 = -101;
deq.push_front(element2);
// Output the size of the deque
std::cout << deq.size() << std::endl;
}
Comments
Leave a comment