C++ Deque back()30 Aug 2024 | 1 min read C++ Deque back() function is used to access the last element of the deque container. SyntaxParameterIt does not contain any parameter. Return valueIt returns a reference to the last element of the deque container. Example 1Let's see a simple example Output: 5 In this example, back() function returns the last element of the deque i.e 5. Example 2Let's see a another simple example Output: Content of deque:15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Next TopicC++ Deque |
Deque shrink_to_fit() function
C++ Deque shrink_to_fit() C++ reduces the memory usage to fit the size of the container. This function does not modify the content of a deque. Syntax void shrink_to_fit(); Parameter It does not contain any parameter. Return value It does not return any value. Example 1 Let's see a simple example #include <iostream> #include<deque> using namespace std; int...
1 min read
Deque cend() function
C++ Deque cend() Function The C++ Standard Template Library (STL) includes many containers, iterators, and algorithms to make programming easier. One of the most flexible containers is the deque (double-ended queue) because we can both insert and remove elements from both ends with reasonable complexity. The...
5 min read
Deque push_front() function
C++ Deque push_front() Function In the C++ programming language, the deque (double-ended queue) is one of the most important features across various Standard Template Library (STL) containers. It allows the programmer to work with elements at either end of the container. The deque has the benefit...
4 min read
Deque erase() function
C++ Deque erase() C++ removes the element from the specified position or range and this effectively reduces the size of the deque by the number of elements removed. Syntax iterator erase(iterator pos); iterator erase(iterator first,iterator last); Parameter pos: It defines the position at which the element to be removed from the...
2 min read
Deque assign() function
C++ Deque assign() C++ assigns new contents to the deque container and the size of the container is modified accordingly. Syntax void assign(InputIterator first, InputIterator last); void assign(int n,value_type val); Parameter (first,last): It defines the range between which the new elements to be inserted. n: It defines the new size of...
1 min read
Deque crbegin() function
C++ Deque crbegin() C++ returns a constant reverse iterator referring to the last element of the deque. An iterator can be incremented or decremented but it cannot modify the content of deque. Where, crbegin() stands for constant reverse beginning. Syntax const_reverse_iterator crbegin(); Parameter It does not contain any parameter. Return value It returns...
1 min read
Deque clear() function
C++ deque clear() Function In the C++ programming language, the deque clear() function is a predefined member function of the deque, i.e., double-ended queue. It can help to remove all the elements from the deque. Once we call the clear() function, the deque becomes empty and...
5 min read
Deque operator[]() function
C++ Deque operator[]() C++ Deque operator[] function is used to access the element at specified position pos. If position pos is greater than the size of container then it returns a value 0. Difference between operator[]() & at() When position pos is greater than the size of the container...
1 min read
Deque end() function
C++ Deque end() Function In the C++ programming language, the deque (double-ended queue) is a container class that is a part of the Standard Template Library (STL). It allows fast insertion and deletion of elements at both the beginning and the end of the deque. In C++,...
5 min read
Deque resize() function
C++ Deque resize() Function The C++ is an inbuilt function that is present in the Standard Template Library (STL) of C++. This function basically changes the size of the deque container to the size given in the argument based on a few conditions. In the C++...
5 min read
We request you to subscribe our newsletter for upcoming updates.

We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India