本文整理汇总了C++中PriorityQueue::peekAtFront方法的典型用法代码示例。如果您正苦于以下问题:C++ PriorityQueue::peekAtFront方法的具体用法?C++ PriorityQueue::peekAtFront怎么用?C++ PriorityQueue::peekAtFront使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PriorityQueue
的用法示例。
在下文中一共展示了PriorityQueue::peekAtFront方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
PriorityQueue<DataType> testPQA;
PriorityQueue<DataType> testPQB;
PriorityQueue<DataType> testPQC;
char cmdChar;
DataType dataItem;
int qPriority;
char qProcess[ SMALL_STR_LEN ];
bool dataChanged;
ShowMenu();
do
{
dataChanged = false;
cout << endl << "Command: "; // Read command
cmdChar = GetCommandInput( qProcess, qPriority );
switch ( cmdChar )
{
case 'c': case 'C': // clear priority queue
while( !testPQA.isEmpty() )
{
testPQA.dequeue( dataItem );
}
if( VERBOSE )
{
cout << " Priority Queue has been cleared " << endl;
}
dataChanged = true;
break;
case 'd': case 'D': // dequeue one data item
testPQA.dequeue( dataItem );
if( VERBOSE )
{
cout << " Process: " << dataItem.process
<< " has been dequeued with a priority of "
<< dataItem.priority << PERIOD << endl;
}
dataChanged = true;
break;
case 'e': case 'E': // enqueue
testPQA.enqueue( qPriority, qProcess );
if( VERBOSE )
{
cout << " Process: " << qProcess
<< " has been enqueued with a priority of "
<< qPriority << PERIOD << endl;
}
dataChanged = true;
break;
case 'h': case 'H': // help request
ShowMenu();
break;
case 'p': case 'P': // peek at next item
testPQA.peekAtFront( dataItem );
if( VERBOSE )
{
cout << " Process: " << dataItem.process
<< " with priority: " << dataItem.priority
<< " found at front of queue." << endl;
}
break;
case 'q': case 'Q': // quit the test program
if( VERBOSE )
{
cout << " End Program Requested" << endl;
}
cout << endl;
break;
case 'x': case 'X': // create copy constructor PQ
//.........这里部分代码省略.........