当前位置: 首页>>代码示例>>C++>>正文


C++ queue::peek方法代码示例

本文整理汇总了C++中queue::peek方法的典型用法代码示例。如果您正苦于以下问题:C++ queue::peek方法的具体用法?C++ queue::peek怎么用?C++ queue::peek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在queue的用法示例。


在下文中一共展示了queue::peek方法的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;  
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:41,代码来源:nodata.cpp


注:本文中的queue::peek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。