本文整理汇总了C++中queue::length方法的典型用法代码示例。如果您正苦于以下问题:C++ queue::length方法的具体用法?C++ queue::length怎么用?C++ queue::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类queue
的用法示例。
在下文中一共展示了queue::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/* return a pointer to three plateauType structures, starting at
location i,j. caller should check valid field in returned
structs. */
nodataType *
detectEdgeNodata::getNodataForward(dimension_type i, dimension_type j,
dimension_type nr, dimension_type nc) {
bool ok;
static nodataType ptarr[3]; /* return value */
nodataType pt;
ok = nodataQueue->peek(0, &pt);
while(ok && (pt.i < i || (pt.i==i && pt.j<j))) {
nodataQueue->dequeue(&pt); /* past needing this, so remove */
ok = nodataQueue->peek(0, &pt);
}
if(ok && pt.i == i && pt.j == j) {
nodataQueue->dequeue(&pt); /* found it, so remove */
ptarr[0] = pt;
} else {
ptarr[0].invalidate();
}
/* locate next two, if possible */
for(int kk=0,k=1; k<3; k++) {
ok = nodataQueue->peek(kk, &pt);
if(ok && pt.i == i && pt.j == j+k) {
ptarr[k] = pt;
kk++; /* found something, so need to peek further forward */
} else {
ptarr[k].invalidate();
}
}
#if(0)
cout << "request at " << i << "," << j << " returns: " <<
ptarr[0] << ptarr[1] << ptarr[2] << endl;
nodataQueue->peek(0, &pt);
cout << "queue length = " << nodataQueue->length()
<< "; head=" << pt << endl;
#endif
return ptarr;
}