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


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

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


在下文中一共展示了istringstream::peek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deserialize

 NestedInteger deserialize(istringstream &in) {
 	int number;
     if(in>>number)	return NestedInteger(number); //如果开头是数字,那么一定是单个数的
     in.clear();
     in.get();
     NestedInteger list;
     while(in.peek() != ']')
     {
     	list.add(deserialize(in));
     	if(in.peek()==',')
     		in.get();
     }
     in.get();
     return list;
 }
开发者ID:whguo,项目名称:LeetCode,代码行数:15,代码来源:385.Mini+Parser.cpp

示例2: parseQuotes

static void parseQuotes(istringstream& result, forward_list<pair<string,quote_>>& quotes)
{
  string row;
  string date;
  float price[4];
  result.ignore(256, '\n');

  while(result.peek() != EOF)
  {
    getline(result, date, ',');
    result>> row;
    result.ignore();
    sscanf(row.c_str(), "%f,%f,%f,%f", &price[0], &price[1], &price[2], &price[3]);

    quotes.push_front(pair<string,quote_>(date, {price[0], price[1], price[2], price[3]}));
  }
}
开发者ID:Wade-Shepardson,项目名称:Stex,代码行数:17,代码来源:retriever.cpp

示例3: if

			verts.push_back(y);
			verts.push_back(z);
			vertc++;//increment the number of vertices.
		}
		else if (line.substr(0,2) == "f ") //if it starts with "f " it is a face.
		{
			istringstream s(line.substr(2));//stream in again for simplicity.
			GLushort a,b,c,d;//temp variables to hold face info as it comes in.
			s >> a; s >> b; s >> c;//read in the face info.
			a--; b--; c--;// each one needs to be decrememnted because .obj is 1 
				//indexed where as vbos are 0 indexed.
			els.push_back(a);//push info onto the vector
			els.push_back(b);
			els.push_back(c);
			elc++;//incrememnt the number of faces.
			char temp = s.peek();
			if ((int)temp != -1)
			{
				s >> d;
				d--;
				els.push_back(a);
				els.push_back(c);
				els.push_back(d);
				elc++;
			}
		}
		else if (line[0] == '#') { /* ignoring this line */ }
		else { /* ignoring this line */ }
 	}

	//these two loops convert the vectors into arrays so they can be sent to opengl.
开发者ID:Narcolapser,项目名称:Delta,代码行数:31,代码来源:Mesh.cpp


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