Article ID: 156768 - Last Review: December 29, 2005 - Revision: 5.0 How to use push_front and pop_front STL functions in Visual C++This article was previously published under Q156768 On This PageSUMMARY The sample code is this article illustrates how to use the
deque::push_front and deque::pop_front STL functions in Visual C++. Deque is a
double-ended queue where elements can be inserted and removed from the front
and from the back. MORE INFORMATIONRequired HeaderPrototypeDescriptionThe push_front function inserts an element with value x at the beginning of the deque container. The pop_front function removes the first element of the deque container, which must be non-empty.Sample CodeNOTE: In the first line of the sample code section, /GX is equivalent to /EHsc in Visual C++ .NET or in Visual C++ 2005 and is set by default.The output is: 3 2 1 The output is: 2 1 The output is: 1 REFERENCES Visual C++ Books On Line: Visual C++ Books:C/C++:Standard
C++ Library Reference. APPLIES TO
| Article Translations
|

Back to the top
