C++ Deque rend()30 Aug 2024 | 1 min read C++ Deque rend() function returns a reverse iterator referring to the element preceding the first element in the deque container. An iterator can be incremented or decremented just like end() function. Where, rend() stands for reverse end. ![]() SyntaxParameterIt does not contain any parameter. Return valueIt returns a reverse iterator pointing to the reverse end of the deque container. Example 1Let's see a simple example Output: lairotuT In this example, reverse iterator is used to iterate from backwards and it iterates until and unless it becomes equal to the c.rend().It prints the reverse content of a deque c i.e lairotuT Example 2Let's see a simple example when reverse iterator is decremented by 2. Output: 2 In this example, reverse iterator is decremented by 2. Therefore, it access the second element of deque. Next TopicC++ Deque |
C++ Deque rbegin() C++ returns a reverse iterator pointing to the last element of the container. An iterator can be incremented or decremented but it cannot modify the content of deque. Where, rbegin() stands for reverse beginning. Note: Reverse iterators are those which iterate from backwards and move...
1 min read
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
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
C++ Deque cbegin() C++ returns a constant iterator pointing to the first element of the deque container. This iterator can be incremented or decremented just like the iterator returned by the begin() function. If the container is empty then the returned iterator will be equal to...
1 min read
C++ Deque size() C++ determines the number of elements present in the deque container. For example: deque<int> d={1,2,3,4,5}; d.size()=5; Syntax return_type size(); where, return_type is an unsigned...
1 min read
C++ emplace_back() C++ adds a new element at the end of the deque and the size of the container is increased by one. Syntax void emplace_back(value_type val); Parameter val: New value to be inserted at the end of the deque. Return value It does not return any value. Example 1 Let's see a...
1 min read
C++ Deque emplace_front() C++ adds a new element to the beginning of the deque container and the size of the container is increased by one. Syntax void emplace_front(value_type val); Parameter val: New value is to be inserted at the beginning of the deque. Return value It does not return any value. Example 1 Let's...
1 min read
C++ Deque empty() C++ checks whether the container is empty or not. If the container is empty, it returns 1 otherwise 0. Syntax void empty() Parameter It does not contain any parameter. Return value It does not return any value. Example 1 Let's see a simple example when deque is not empty. #include <iostream> #include<deque> using...
1 min read
C++ Deque end() C++ returns an iterator pointing to the "past-the-last" element of deque. If the deque container is empty then the end() function returns the same as the begin() function. where, past-the-last: The "past-the-last" is the element that follows the last element and it does not...
1 min read
C++ Deque swap() C++ exchanges the content of a given deque with the deque passed in the parameter of same type. Conditions: Type of deque cannot be different. Size of deque can vary. Syntax void swap(deque& second); Parameter second: It is an another deque container whose content is to be swapped with the...
2 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