本文整理汇总了C++中Trail::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Trail::end方法的具体用法?C++ Trail::end怎么用?C++ Trail::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trail
的用法示例。
在下文中一共展示了Trail::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: countIntersectionOfTrails
int countIntersectionOfTrails( const Trail& sx, const Trail& sy )
{
int inter(0);
Trail::const_iterator sxt = sx.begin();
Trail::const_iterator syt = sy.begin();
Trail::const_iterator sxe = sx.end();
Trail::const_iterator sye = sy.end();
for ( ; sxt!=sxe && syt!=sye ; )
{
if ( *sxt < *syt )
++sxt;
else if ( *sxt > *syt )
++syt;
else
{
++inter;
++sxt;
++syt;
}
}
return inter;
}
示例2: trelliToLadder
void trelliToLadder( const TrelliMatrix& trellis, Trail& bestTrail )
{
bestTrail.clear();
// The -1 is needed because the trellis matrix is one larger than the similarity matrix.
// This points to its downmost rightmost element.
const int huBookSize = trellis.size()-1;
const int enBookSize = trellis.otherSize()-1;
int huPos=huBookSize;
int enPos=enBookSize;
bool logging = false;
if (logging) std::cerr << std::endl;
bool over = false;
bool hopelesslyBadTrail = false;
bestTrail.push_back(std::make_pair(huPos,enPos));
while (true)
{
unsigned char trelli = trellis[huPos][enPos];
// std::cerr << huPos << "," << enPos << "," << (int)trelli << std::endl;
if ((huPos==0) || (enPos==0))
break;
switch (trelli)
{
case Diag :
{
--huPos;
--enPos;
break;
}
case HuSkip :
{
--huPos;
break;
}
case EnSkip :
{
--enPos;
break;
}
case HuHuEnSkip :
{
huPos -= 2;
--enPos;
break;
}
case HuEnEnSkip :
{
--huPos;
enPos -= 2;
break;
}
case Dead :
{
over = true;
break;
}
default:
{
hopelesslyBadTrail = true;
over = true;
break;
}
}
if (over)
break;
bestTrail.push_back(std::make_pair(huPos,enPos));
if (logging)
{
std::cerr << huPos << " \t" << enPos << std::endl;
}
}
if (hopelesslyBadTrail)
{
bestTrail.clear();
bestTrail.push_back(std::make_pair(huBookSize,enBookSize));
bestTrail.push_back(std::make_pair(0,0));
std::cerr << "Error: hopelessly bad trail." << std::endl;
}
std::reverse(bestTrail.begin(), bestTrail.end() );
}