本文整理汇总了C++中Match::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Match::insert方法的具体用法?C++ Match::insert怎么用?C++ Match::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillMatching
// Method fills the map matching, which is a multimap of the highest
// scoring words for a given line. This is because one line may give
// multiple same-scoring words that are all 'the best' word to play
// for a move, such as how tiles 'abcdefg' give badge, cafe, and face,
// which are each worth 9 points. Method will continue to add new
// same-scoring words until a word of higher score is found, which resets
// the map for the particular key.
void fillMatching(const string &line, const string &s)
{
wordScore = myScored.find(s)->second; // set wordScore to score of word
if(count == 0)
{
highScore = wordScore;// set highScore to score of word
matching.insert(Match::value_type(line, s)); //insert into map
setCount(); // increase count
}//if(count == 0)
else
{
for(Match::const_iterator itr = matching.begin(); itr != matching.end(); itr++)
if(s == itr->second)
return;
if(wordScore > highScore)
{
matching.erase(line);
count = 0;
matching.insert(Match::value_type(line, s)); //insert into map
highScore = wordScore;
setCount();
}// if(wordScore > highScore)
else
{
if(wordScore == highScore)
{
matching.insert(Match::value_type(line, s)); //insert into map
setCount(); //increment count
} // if(wordScore == highScore)
else
return; // wordScore < highScore, so ignore and leave
}// else wordScore <= highScore
}// else count > 0
return;
} // void fillMatching()