Export (0) Print
Expand All

Why Use a Queue?

Visual Studio 6.0

You'll use a queue data structure in an application when you need to maintain a list of items ordered not by their value, but by their temporal value. For example, you might want to allow users to select a list of reports throughout the day and, at idle times throughout the day, print those reports. Although there are many ways to store this information internally, a queue makes an ideal mechanism. When you need to find the name of the next report to print, just pull it from the top of the queue. When you add a new report to be printed, it goes to the end of the queue.

You can also think of a queue as a pipeline—a means of transport for information from one place to another. You could create a global variable in your application to refer to the queue and have various parts of the application send messages to each other using the queue mechanism, much as Windows itself does with the various running applications.

© 1997 by SYBEX Inc. All rights reserved.

Show:
© 2014 Microsoft