The C++ deque empty function is a deque container method used to check whether a deque is empty or not. It returns true if the deque is empty and false otherwise.
Examples:
Code 1:
#include #include
int main() { std::deque mydeque; mydeque.push_back(10); if(mydeque.empty()) std::cout << "Deque is empty\n"; else std::cout << "Deque is not empty\n"; return 0; }
Output: Deque is not empty
In this example, we create a deque object and add an element to it using the push_back method. Then we check if the deque is empty or not using the empty method.
Code 2:
#include #include
int main() { std::deque mydeque; if(mydeque.empty()) std::cout << "Deque is empty\n"; else std::cout << "Deque is not empty\n"; return 0; }
Output: Deque is empty
In this example, we create an empty deque object and check if it is empty or not using the empty method.
This function is part of the C++ Standard Library and is included in the header file.
C++ (Cpp) Deque::empty - 9 examples found. These are the top rated real world C++ (Cpp) examples of Deque::empty from package code extracted from open source projects. You can rate examples to help us improve the quality of examples.