本文整理汇总了C++中yvector::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ yvector::erase方法的具体用法?C++ yvector::erase怎么用?C++ yvector::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yvector
的用法示例。
在下文中一共展示了yvector::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SubstituteByMultiWord
void CMultiWordCreator::SubstituteByMultiWord(SWordHomonymNum& WordHomonymNum, yvector<SWordHomonymNum>& WordIndexes)
{
const CWord& multi_word = m_Words.GetWord(WordHomonymNum);
int k1 = -1, k2 = -1;
for (size_t i = 0; i < WordIndexes.size(); i++) {
const CWord& w = m_Words.GetWord(WordIndexes[i]);
if ((w.IsOriginalWord()) &&
(w.GetSourcePair().FirstWord() == multi_word.GetSourcePair().FirstWord()))
k1 = i;
if (k1 != -1) {
if (!w.IsOriginalWord())
break;
if (w.GetSourcePair().FirstWord() == multi_word.GetSourcePair().LastWord()) {
k2 = i;
break;
}
}
}
if ((k1 != -1) && (k2 != -1))
for (int j = k2; j >= k1; j--)
WordIndexes.erase(WordIndexes.begin() + j);
if (k1 != -1)
WordIndexes.insert(WordIndexes.begin() + k1, WordHomonymNum);
}
示例2: SolveAmbiguity_Old
void SolveAmbiguity_Old(yvector< COccurrence >& Occurrences)
{
//previous version of disambiguation - it is quite slower in worst cases
sort (Occurrences.begin(), Occurrences.end());
InitAmbiguousSlot(Occurrences);
//int CountOfAmbigousPlaces = 0;
for (size_t i = 0; i + 1 < Occurrences.size(); ++i)
if (Occurrences[i + 1].first < Occurrences[i].second) {
CPeriodSolutionWeight Solution;
Solution.m_VirtualGroup.SetPair(Occurrences[i].first,Occurrences[i].first);
size_t MaxRightBorder = Occurrences[i].second;
SolveAmbiguityRecursive(Occurrences,i, Solution, MaxRightBorder);
assert (!Solution.m_Solution.empty());
int j=Solution.m_Solution.back() + 1;
for (; j < (int)Occurrences.size(); ++j)
if (Occurrences[j].first >= Occurrences[Solution.m_Solution.back()].second)
break;
Occurrences.erase(Occurrences.begin() + Solution.m_Solution.back() + 1, Occurrences.begin() + j);
for (size_t k=Solution.m_Solution.size() - 1; k > 0; --k) {
size_t start = Solution.m_Solution[k - 1] + 1;
size_t end = Solution.m_Solution[k];
Occurrences.erase(Occurrences.begin() + start, Occurrences.begin() + end);
};
Occurrences.erase(Occurrences.begin() + i, Occurrences.begin() + Solution.m_Solution[0]);
//CountOfAmbigousPlaces++;
};
//printf ("Count Of Ambiguous Places is %i\n",CountOfAmbigousPlaces);;
};