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


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

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


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

示例1: init

	void init(){
		string ff;
		hash_map<int, string> user;
		ifstream fin("in");
		int k = 0;

		while (true){
			if (fin.eof())break;
			fin >> ff;
			vector<string> tmp;
			split(ff, ",", tmp);
			hash_map<string, vector<Node>*>::iterator it = mylog.find(tmp[0]);
			if (it == mylog.end()){
				vector<Node>* newVector = new vector<Node>();
				mylog[tmp[0]] = newVector;
				user[k++] = tmp[0];
			}

			mylog[tmp[0]]->push_back(Node(tmp[0], tmp[1], tmp[2], tmp[3]));
		}
		fin.close();
		hash_map<string, vector<Node>*>::iterator it;
		for (it = mylog.begin(); it != mylog.end(); it++){
			vector<string> v;
			net[it->first] = v;
			for (int i = 0; i < 5; i++){
				int ran = rand() % 9999;
				net[it->first].push_back(user[ran]);
			}
		}
	}
开发者ID:ladfaa,项目名称:CCF,代码行数:31,代码来源:源.cpp

示例2: merge_recommended_queries

  void query_recommender::merge_recommended_queries(std::multimap<double,std::string,std::less<double> > &related_queries,
      hash_map<const char*,double,hash<const char*>,eqstr> &update)
  {
    hash_map<const char*,double,hash<const char*>,eqstr>::iterator hit;
    std::multimap<double,std::string,std::less<double> >::iterator mit
    = related_queries.begin();
    while(mit!=related_queries.end())
      {
        std::string rquery = (*mit).second;
        if ((hit = update.find(rquery.c_str()))!=update.end())
          {
            (*hit).second = std::min((*mit).first,(*hit).second);
            std::multimap<double,std::string,std::less<double> >::iterator mit2 = mit;
            ++mit;
            related_queries.erase(mit2);
          }
        else ++mit;
      }
    hit = update.begin();
    hash_map<const char*,double,hash<const char*>,eqstr>::iterator chit;
    while(hit!=update.end())
      {
        related_queries.insert(std::pair<double,std::string>((*hit).second,std::string((*hit).first)));
        chit = hit;
        ++hit;
        free_const((*chit).first);
      }

  }
开发者ID:Psycojoker,项目名称:seeks,代码行数:29,代码来源:query_recommender.cpp

示例3: replace

	void replace(string user){

		double min = 1000;
		int minI = -1;
		for (int i = 0; i < net[user].size(); i++){
			double tmp = sim(user, net[user][i]);
			if (min > tmp){
				min = tmp;
				minI = i;
			}
		}
		double max = -10000;
		string kk;
		hash_map<string, vector<Node>*>::iterator it;
		for (it = mylog.begin(); it != mylog.end(); it++){
			if (in(it->first, net[user])){
				continue;
			}
			double tmp = sim(user, it->first);
			if (max < tmp){
				max = tmp;
				kk = it->first;
			}
		}
		if (min < max){
			net[user][minI] = kk;
		}
	}
开发者ID:ladfaa,项目名称:CCF,代码行数:28,代码来源:源.cpp

示例4: DumpDOT

void DumpDOT(
	char *Filename,
	multimap <OperandPosition,OperandPosition,OperandPositionCompareTrait> &InstructionMap,
	hash_map <ea_t,insn_t> &InstructionHash
)
{
	HANDLE hFile=OpenLogFile(Filename);
	//InstructionMap
	//InstructionHash
	WriteToLogFile(hFile,"digraph g {\r\n\
		graph [\r\n\
		rankdir = \"TB\"\r\n\
		];\r\n\
		node [\r\n\
		fontsize = \"12\"\r\n\
		];\r\n\
		edge [\r\n\
		];\r\n");

	//shape = \"ellipse\"\r\n\

	hash_map <ea_t,insn_t>::iterator InstructionHashIter;
	//Write Node Data
	for(InstructionHashIter=InstructionHash.begin();InstructionHashIter!=InstructionHash.end();InstructionHashIter++)
	{
		ea_t address=InstructionHashIter->first;
		char op_buffer[100]={0,};
		ua_mnem(address,op_buffer,sizeof(op_buffer));

		WriteToLogFile(hFile,"\"%X\" [\r\n\tlabel=\"%s",address,op_buffer);
		for(int i=0;i<UA_MAXOP;i++)
		{
			if(InstructionHashIter->second.Operands[i].type>0)
			{
				char operand_str[MAXSTR]={0,};
				ua_outop(address,operand_str,sizeof(operand_str)-1,i);
				tag_remove(operand_str,operand_str,0);
				char *escaped_operand_str=EscapeString(operand_str);
				if(escaped_operand_str)
				{
					WriteToLogFile(hFile,"|<f%u>%s",i,escaped_operand_str);
					free(escaped_operand_str);
				}
			}
		}
		WriteToLogFile(hFile,"\"\r\n\tshape=\"record\"\r\n];\r\n\r\n");
	}

	multimap <OperandPosition,OperandPosition,OperandPositionCompareTrait>::iterator InstructionMapIter;
	for(InstructionMapIter=InstructionMap.begin();InstructionMapIter!=InstructionMap.end();InstructionMapIter++)
	{
		WriteToLogFile(hFile,"\"%X\":f%u -> \"%X\":f%u\r\n",
			InstructionMapIter->first.Address,
			InstructionMapIter->first.Index,
			InstructionMapIter->second.Address,
			InstructionMapIter->second.Index);
	}
	CloseLogFile(hFile);
}
开发者ID:BwRy,项目名称:DarunGrim,代码行数:59,代码来源:IDAAnalysis.cpp

示例5: set_replicating_map

 void ReplicateInfoMessage::set_replicating_map(const hash_map<uint32_t, ReplBlock*>& src)
 {
   hash_map<uint32_t, ReplBlock*>::const_iterator it = src.begin();
   for (; it != src.end(); ++it)
   {
     replicating_map_.insert(REPL_BLOCK_MAP::value_type(it->first, *(it->second)));
   }
 }
开发者ID:qqiangwu,项目名称:annotated-tfs,代码行数:8,代码来源:server_status_message.cpp

示例6: CheckIfHaveCreative

void AdGroupPool::CheckIfHaveCreative(hash_map<Ice::Long, AdGroupPtr> & group_pool) {
  for (hash_map<Ice::Long, AdGroupPtr>::iterator git = group_pool.begin(); git != group_pool.end();) {
    if (!git->second->HasCreatives()) {
//      MCE_DEBUG("AdGroupPool::Init --> because obj->HasCreatives is false so erase it  groupid = " << git->first);
      group_pool.erase(git++);
    } else{
      ++git;
    }
  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:10,代码来源:AdCache.cpp

示例7: enorm

 // static.
 float oskmeans::enorm(const hash_map<uint32_t,float,id_hash_uint> &p)
 {
   float enorm = 0.0;
   hash_map<uint32_t,float,id_hash_uint>::const_iterator hit = p.begin();
   while (hit!=p.end())
     {
       enorm += (*hit).second*(*hit).second;
       ++hit;
     }
   return sqrt(enorm);
 }
开发者ID:Quix0r,项目名称:seeks,代码行数:12,代码来源:oskmeans.cpp

示例8: mapSave

void mapSave(string fileName, hash_map<int, int> &feature2kernel)
{
	ofstream outfile;
	outfile.open(fileName);

	for (hash_map<int, int>::iterator iter = feature2kernel.begin(); iter != feature2kernel.end(); iter++)
	{
		outfile << iter->first << " " << iter->second << endl;
	}

	outfile.close();

}
开发者ID:trantorznh,项目名称:maxPooing_denseSampling_in_fine-grained-classification,代码行数:13,代码来源:supportFunc.cpp

示例9: setSymbolInformation

/***************************************************************************
 * Set symbol information
 ***************************************************************************/
bool CCilVm::setSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo)
{
	if( m_status != VM_EXECUTE_INITIALIZING ) return false;

	hash_map<wstring, CG_SYMBOL_INFORMATION>::iterator it = symbolinfo.begin();

	pair<wstring, CG_SYMBOL_INFORMATION> pair;
	for( ; it != symbolinfo.end(); ++it)
	{
		pair = *it;
		m_SymbolInfoPool[ pair.first ] = pair.second;
	}
	return true;
}
开发者ID:hak,项目名称:criscript,代码行数:17,代码来源:cilVMStaticField.cpp

示例10: free

/*************************************************
* Function: * check_connect_timeout
* Description: * 检测长时间没反应的网络连接,并关闭删除
* Input: *
* Output: *
* Others: *
*************************************************/
void *check_connect_timeout(void* para)
{
    hash_map<int, sockStruct>::iterator it_find;
    for(it_find = sock_map.begin(); it_find!=sock_map.end(); ++it_find){
        if( time((time_t*)0) - (it_find->second).time > 120){                //时间更改


            free((it_find->second).recvBuf);
            sock_map.erase(it_find);

            close(it_find->first);
        }
    }

}
开发者ID:OnelongX,项目名称:handy,代码行数:22,代码来源:ettest.cpp

示例11: main

int main(int argc, char *argv[]){

  for( int i = 1; i < argc; i++){
    fprintf(stderr,"[[[[[%s]]]]]",argv[i]);
  }
  char *fname;

  pthread_rwlock_init(&histoLock,NULL);
  for( int i = 2; i < argc; i++){
    files.push_back(string(argv[i]));
  }

  deserializeFromFile( argv[1] );

  //cerr << "Size is: " << files.size() << endl;

  pthread_t threads[NUM_THREADS];
  for(int i = 0; i < NUM_THREADS; i++){
    pthread_create(&(threads[i]), NULL, runner, (void *)i);
  }
  
  for(int i = 0; i < NUM_THREADS; i++){
    pthread_join(threads[i], NULL);
  }

  for( hash_map<string, hash_map<string, vector<unsigned long> > >::iterator it = histo.begin();
       it != histo.end(); it++ ){

    for(hash_map<string, vector<unsigned long> >::iterator it2 = it->second.begin();
        it2 != it->second.end(); it2++){

      cout << it->first << " " << it2->first << " ";

      for(vector<unsigned long>::iterator vi = it2->second.begin();
          vi != it2->second.end(); vi++ ){

        cout << *vi << " ";


      }

      cout << endl;

    }

  }
  
}
开发者ID:blucia0a,项目名称:Aviso,代码行数:48,代码来源:computePairHistogram.cpp

示例12: createPermutation

    void createPermutation(hash_map<int,int> hm,vector<int> cur,vector<vector<int> >& res){
        if(hm.size()){
    		for(hash_map<int,int>::iterator it=hm.begin();it!=hm.end();it++){
				vector<int> tVec(cur);
				hash_map<int,int> tMap(hm);
				tVec.push_back(it->first);
				if(tMap[it->first]==1)
					tMap.erase(it->first);
				else
					tMap[it->first]--;
				createPermutation(tMap,tVec,res);
			}
		}
		else
			res.push_back(cur);
	}
开发者ID:husscc,项目名称:leetcode,代码行数:16,代码来源:PermutationsII.cpp

示例13: distance_normed_points

  float oskmeans::distance_normed_points(const hash_map<uint32_t,float,id_hash_uint> &p1,
                                         const hash_map<uint32_t,float,id_hash_uint> &p2)
  {
    float dist = 0.0;
    hash_map<uint32_t,float,id_hash_uint>::const_iterator hit = p1.begin();
    hash_map<uint32_t,float,id_hash_uint>::const_iterator hit2;
    while (hit!=p1.end())
      {
        if ((hit2=p2.find((*hit).first))!=p2.end())
          {
            dist += (*hit).second * (*hit2).second;
          }
        ++hit;
      }

    return dist;
  }
开发者ID:Quix0r,项目名称:seeks,代码行数:17,代码来源:oskmeans.cpp

示例14:

void 
sat_solver::generate_evidence(hash_map<int, bool> vMap)
{
  int size = _path.size();
  for(int i = 0; i < size; i++)
  {
    string s = set_to_string(_path[i]);
    _evidence += s + ", ";
  }
  string literals = "";
  hash_map<int, bool>::iterator it;
  for(it = vMap.begin(); it != vMap.end(); it ++)
  {
    if(it->second)
      literals += aalta_formula::get_name(it->first);
    else
      literals += "!" + aalta_formula::get_name(it->second);
  }
  _evidence += "(" + literals + ")";
}
开发者ID:juzer10,项目名称:FSE-2014-Aalta,代码行数:20,代码来源:sat_solver.cpp

示例15: setSymbolInformation

	/***************************************************************************
	 * Set symbol information
	 ***************************************************************************/
	void CCilDisasm::setSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo)
	{
		hash_map<wstring, CG_SYMBOL_INFORMATION>::iterator it = symbolinfo.begin();
		
		pair<wstring, CG_SYMBOL_INFORMATION> pair;
		for( ; it != symbolinfo.end(); ++it)
		{
			pair = *it;
			m_SymbolInfoPool[ pair.second.rid ] = pair.first;
			
			if( SymbolTypeFromFrag( pair.second.Flags ) == CG_SYMBOL_FLAG_GLOBAL
			   && pair.second.ridObject )
			{
				//Builtin object handling.
				//They are stored both in static field and RID
				m_SymbolInfoPool[ pair.second.ridObject ] = pair.first;
			}
			
		}
		
	}
开发者ID:hak,项目名称:criscript,代码行数:24,代码来源:cilDebuggerDisasm.cpp


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