C++ Deque push_back
The push_back method in a C++ Deque appends a new element to the back of the deque data structure, resulting in an increment in the container's size by one.
Syntax
Example
void push_back(value_type val);
Parameter
val : The fresh value to be added at the conclusion of the deque container.
Return value
It does not return any value.
Example 1
Let's see a simple example
Example
#include <iostream>
#include<deque>
using namespace std;
int main()
{
deque<int> d={10,20,30,40};
deque<int>::iterator itr;
d.push_back(50);
for(itr=d.begin();itr!=d.end();++itr)
cout<<*itr<<" ";
return 0;
}
Output:
Output
10 20 30 40 50
In this instance, the push_back method appends a new element, specifically 50, to the tail of the deque.