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


C++ IDList::begin方法代码示例

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


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

示例1: FindInIDList

// searches IDList idL for std::string s, returns its position, -1 if not found
inline int FindInIDList(IDList& idL,const std::string& s)
{
//   int ix=0;
  for(IDList::iterator i=idL.begin(); i != idL.end(); ++i)//, ++ix) 
    if( *i==s) 
      {
	return i - idL.begin();
      }

  return -1;
}
开发者ID:vedraiyani,项目名称:GDL,代码行数:12,代码来源:typedefs.hpp

示例2:

//------------------------------------------------------------------------------
void Solver::HashTable::Fill
(
    const IDList& particleIDs
)
{
    // clear all buckets
    for (unsigned int i = 0; i < mDomain.Dimensions.X*mDomain.Dimensions.Y; i++)
    {
        mBuckets[i].clear();
    }

    // fill buckets
    IDList::const_iterator i = particleIDs.begin();
    IDList::const_iterator e = particleIDs.end();

    for (; i != e; i++)
    {
        unsigned int hash = computeHash
                            (
                                Vector2f(&mPositions[2*(*i)]),
                                mDomain
                            );
        mBuckets[hash].push_back(*i);
    }

}
开发者ID:segfault11,项目名称:SPH2S,代码行数:27,代码来源:Solver.cpp

示例3: Find

  int Find( const std::string& name)
  {
    String_abbref_eq strAbbrefEq_name(name);

    // search keyword
    IDList::iterator f=std::find_if(listName.begin(),
			       listName.end(),
			       strAbbrefEq_name);
    if( f == listName.end()) return -1;

    // Note: there might be duplicate extra keyword names, return first one
//     // continue search (for ambiguity)
//     IDList::iterator ff=std::find_if(f+1,
// 				listName.end(),
// 				strAbbrefEq_name);
//     if( ff != listName.end())
//       {
// 	throw GDLException("Ambiguous keyword abbreviation in _EXTRA: "+name);
//       }
    return std::distance( listName.begin(),f);
  }
开发者ID:ezhangle,项目名称:GNU-Data-Language-0.9.6,代码行数:21,代码来源:extrat.hpp

示例4: declare

void BaseSemanticWalker::declare(const IDList& ids, Type* type) {
  IDList::const_iterator it;
  for (it = ids.begin(); it != ids.end(); ++it) {
    try {
      _symtable->insertSymbol(
        Symbol((*it)->getText(),
              type,
              _symtable->currentScope(),
              _symtable->unit(),
              (*it)->getLine(),
              (*it)->getColumn()));
    } catch (RedeclarationException e) {
      report((*it)->getLine(), (*it)->getColumn(),
            std::string("redeclaração: ") + e.symbol().lexeme());
    }
  }
}
开发者ID:BackupTheBerlios,项目名称:gpt-svn,代码行数:17,代码来源:BaseSemanticWalker.cpp

示例5: printClusters

int printClusters(NodeSet roots, IDList orphanNodes,
	string clusterListName, string clusterName, 
	vector<float> cutoffs)
{   
	TreeNode *tempNode = 0;
	NodeSetIter setIter;

	NodeList nodeList, tempList;
	NodeListIter nodeIt, tempIt;
	
	IDList OTU;
	IDListIter it;
	
	unsigned int size, numOTUs;
	FILE *clusterListFile, *clusterFile;

	clusterListFile = fopen(clusterListName.c_str(),"wb");
	clusterFile = fopen(clusterName.c_str(),"wb");
	if(clusterListFile == NULL|| clusterFile == NULL)
	{   
		cout << "Cannot open output files. Skipped" << endl;
		return 0;
	}
	printf("\n");

	vector<float>::iterator c;
	float distLevel;
	for(c = cutoffs.begin(); c != cutoffs.end(); c++)
	{   
		distLevel = *(c);
		numOTUs = 0;
		nodeList.clear();
		
		// extract the valid nodes for each distance level
		for(setIter=roots.begin(); setIter!=roots.end(); ++setIter)
		{   
			tempNode=0;
			if(*setIter != 0)
			{   
				if((*setIter)->dist < distLevel || fabs((*setIter)->dist-distLevel) < EPSILON)
				{   
					nodeList.push_front(*setIter);
					continue;
				}

				tempList.push_front(*setIter);
				while (tempList.size()!=0)
				{   
					tempIt=tempList.begin();
					tempNode=(*tempIt);
					tempList.pop_front();

					if (tempNode->left->dist < distLevel || fabs(tempNode->left->dist-distLevel) < EPSILON)
						nodeList.push_front(tempNode->left);						
					else
						tempList.push_front(tempNode->left);

					if (tempNode->right->dist < distLevel || fabs(tempNode->right->dist-distLevel) < EPSILON)
						nodeList.push_front(tempNode->right);
					else
						tempList.push_front(tempNode->right);					
				}
			}
			tempList.clear();
		}

		fprintf(clusterListFile," %.6f ", distLevel);
		fprintf(clusterFile," %.6f ", distLevel);
		
		// write the nodeList to file
		tempList.clear();
		for(nodeIt=nodeList.begin(); nodeIt!=nodeList.end(); ++nodeIt)
		{   
			// clean up and initialize
			fprintf(clusterFile,"|");
			tempNode=0;			
			size=0;
			OTU.clear();
			
			tempList.push_front(*nodeIt);
			
			while(tempList.size()!=0)
			{   
				tempIt=tempList.begin();
				tempNode=(*tempIt);
				tempList.pop_front();
				
				if(tempNode->left==0 && tempNode->right==0)
				{   
					OTU.push_back(tempNode->ID);
					size+=tempNode->numMembers;
				}				
				if (tempNode->right!=0)
					tempList.push_front(tempNode->right);
				if(tempNode->left!=0 )
					tempList.push_front(tempNode->left);
				
			}
			tempList.clear();					
			// print to clusterFile
//.........这里部分代码省略.........
开发者ID:ngthuydiem,项目名称:crispy,代码行数:101,代码来源:sparsecut.cpp

示例6: addGUID

void UpdateData::addGUID(const IDList& id)
{
	m_guidList.insert(id.begin(), id.end());
}
开发者ID:helloqinglan,项目名称:qinglan,代码行数:4,代码来源:UpdateData.cpp


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