本文整理汇总了C++中CoordinateSequence::last方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordinateSequence::last方法的具体用法?C++ CoordinateSequence::last怎么用?C++ CoordinateSequence::last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordinateSequence
的用法示例。
在下文中一共展示了CoordinateSequence::last方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tryAdd
/// Tries to add another sequence onto the start or end of this one.
/// If it succeeds, the other sequence may also be modified and
/// should be considered "spent".
bool tryAdd(CoordinateSequence &other) {
//add the sequence at the end
if (last()==other.first()) {
coordinates.pop_back();
addToEnd(other.coordinates);
return true;
}
//add the sequence backwards at the end
if (last()==other.last()) {
coordinates.pop_back();
other.reverse();
addToEnd(other.coordinates);
return true;
}
//add the sequence at the beginning
if (first()==other.last()) {
coordinates.pop_front();
addToBegin(other.coordinates);
return true;
}
//add the sequence backwards at the beginning
if (first()==other.first()) {
coordinates.pop_front();
other.reverse();
addToBegin(other.coordinates);
return true;
}
return false;
}