本文整理汇总了C++中Queue::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Queue::Remove方法的具体用法?C++ Queue::Remove怎么用?C++ Queue::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void MinHblt<T>::LevelOrder(HbltNode<T>* t) {
Queue<HbltNode<T> *> q;
while (t != NULL) {
Visit_(t);
if (t->left_ != NULL)
q.push(t->left_);
if (t->right_ != NULL)
q.push(t->right_);
if (q.Empty()) {
return;
}
else {
t = q.Remove();
}
}
}
示例2: propagate
void Router::propagate(Coordinate *source, Coordinate *target){
int stepId = 0;
queue->Add(source);
visit(source, stepId);
Coordinate *current;
GridPoint currentGridPoint;
bool targetFound = false;
do{
//get the next node from queue
current = queue->Remove();
currentGridPoint = getGridPointAt(current);
stepId = currentGridPoint.StepId + 1;
//get neighbors of source
Coordinate *neighbors = current->GetNeighbors();
int i;
//if any of them is the target, stop,
for (i = 0; i < 4; i++) {
if(neighbors[i].Equals(target)){
visit(&neighbors[i], stepId);
targetFound = true;
break;
}
//add it to the queue if
//it is not out of bounds
//it is not visited
if(neighbors[i].InBound(rows, cols) && !isVisited(&neighbors[i])){
queue->Add(&neighbors[i]);
visit(&neighbors[i], stepId);
}
}
}while(!queue->IsEmpty() && !targetFound);
//else add them to the queue
//do the same with the rest of the elements in the queue until the target is
//reached
}