c ++ hashmap;更新添加新密钥而不是更新

时间:2015-04-10 15:18:40

标签: c++ hashmap

我有这个代码,我拿一个hashmap,拿一个键并更新值。但是,循环永远不会结束,因为代码将新键添加到散列映射而不是更新。如果您能提供帮助,请告诉我们: -

typedef indri::utility::HashTable< Gram*, double, Gram::hash,Gram::string_comparator > HGramScore;

 HGramScore _gramScores;

HGramScore::iterator iter_score;

cout << "Sizeee " << _gramScores.size() << endl;

int count = 0;  

for (iter_score = _gramScores.begin(); iter_score != _gramScores.end() ; iter_score++)

{

  count++;

  cout << "Sizeee " << _gramScores.size() << endl;

   _gramScores.insert(*iter_score->first , *iter_score->second / total_score_count);

  cout << count << endl;

}

0 个答案:

没有答案