Article ID: 157622 - Last Review: August 16, 2005 - Revision: 5.2 How to use the member functions of the STL queue class in Visual C++This article was previously published under Q157622 NOTE: Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET
2003 supported both the managed code model that is provided by the .NET
Framework and the unmanaged native Windows code model. The information in this
article applies to unmanaged Visual C++ code only. On This PageSUMMARY The sample code below illustrates how to use the
queue::push, queue::pop, queue::empty, queue::back, queue::front, and
queue::size STL functions in Visual C++. MORE INFORMATION The queue adapter holds objects of the type defined by the
type of container supported by the queue. The two containers supported are the
list and the deque. Objects are inserted by push() and removed by pop().
front() returns the oldest item in the queue (also known as FIFO), and back()
returns the latest item inserted in the queue. Required HeaderPrototypes ---------- queue::push(); queue::pop(); queue::empty(); queue::back(); queue::front(); queue::size(); DescriptionThe sample shows queue implementation using list and deque containers.Sample Code201 size of q is:4 42 100 49 201 horse size of p is:5 cat ape dog mouse horse REFERENCES For the same information about member functions of the STL
queue class, visit the following Microsoft Developer Network (MSDN) Web site: http://msdn.microsoft.com/en-us/library/403xk7b1.aspx
(http://msdn.microsoft.com/en-us/library/403xk7b1.aspx)
APPLIES TO
| Article Translations
|

Back to the top
