当前位置: 首页>>代码示例>>C++>>正文


C++ IndexRange::end方法代码示例

本文整理汇总了C++中IndexRange::end方法的典型用法代码示例。如果您正苦于以下问题:C++ IndexRange::end方法的具体用法?C++ IndexRange::end怎么用?C++ IndexRange::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IndexRange的用法示例。


在下文中一共展示了IndexRange::end方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: add

// Compute a range A-B and add it to the list.
void HexagonBlockRanges::RangeList::addsub(const IndexRange &A,
      const IndexRange &B) {
  // Exclusion of non-overlapping ranges makes some checks simpler
  // later in this function.
  if (!A.overlaps(B)) {
    // A - B = A.
    add(A);
    return;
  }

  IndexType AS = A.start(), AE = A.end();
  IndexType BS = B.start(), BE = B.end();

  // If AE is None, then A is included in B, since A and B overlap.
  // The result of subtraction if empty, so just return.
  if (AE == IndexType::None)
    return;

  if (AS < BS) {
    // A starts before B.
    // AE cannot be None since A and B overlap.
    assert(AE != IndexType::None);
    // Add the part of A that extends on the "less" side of B.
    add(AS, BS, A.Fixed, false);
  }

  if (BE < AE) {
    // BE cannot be Exit here.
    if (BE == IndexType::None)
      add(BS, AE, A.Fixed, false);
    else
      add(BE, AE, A.Fixed, false);
  }
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:35,代码来源:HexagonBlockRanges.cpp

示例2: end

bool HexagonBlockRanges::IndexRange::contains(const IndexRange &A) const {
  if (start() <= A.start()) {
    // Treat "None" in the range end as equal to the range start.
    IndexType E = (end() != IndexType::None) ? end() : start();
    IndexType AE = (A.end() != IndexType::None) ? A.end() : A.start();
    if (AE <= E)
      return true;
  }
  return false;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:10,代码来源:HexagonBlockRanges.cpp

示例3: reverse

IndexRange reverse(IndexRange arg) {
    if (arg.empty()) {
        return arg;
    } else {
        if (arg.start() < arg.end()) {
            return IndexRange::between(arg.end() - 1, arg.start() - 1);
        } else {
            return IndexRange::between(arg.end() + 1, arg.start() + 1);
        }
    }
}
开发者ID:DJMaxergy,项目名称:mixxx,代码行数:11,代码来源:indexrange.cpp

示例4:

		bool operator < ( const Structure& o) const
		{
			if (structname < o.structname) return true;
			if (structname > o.structname) return false;
			if (source.end() < o.source.end()) return true;
			if (source.end() > o.source.end()) return false;
			if (sink.end() < o.sink.end()) return true;
			if (sink.end() > o.sink.end()) return false;
			if (source.start() < o.source.start()) return true;
			if (source.start() > o.source.start()) return false;
			return (sink.start() < o.sink.start());
		}
开发者ID:patrickfrey,项目名称:strus,代码行数:12,代码来源:storageDocumentChecker.hpp

示例5: start

bool HexagonBlockRanges::IndexRange::overlaps(const IndexRange &A) const {
  // If A contains start(), or "this" contains A.start(), then overlap.
  IndexType S = start(), E = end(), AS = A.start(), AE = A.end();
  if (AS == S)
    return true;
  bool SbAE = (S < AE) || (S == AE && A.TiedEnd);  // S-before-AE.
  bool ASbE = (AS < E) || (AS == E && TiedEnd);    // AS-before-E.
  if ((AS < S && SbAE) || (S < AS && ASbE))
    return true;
  // Otherwise no overlap.
  return false;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:12,代码来源:HexagonBlockRanges.cpp

示例6: assert

void HexagonBlockRanges::IndexRange::merge(const IndexRange &A) {
  // Allow merging adjacent ranges.
  assert(end() == A.start() || overlaps(A));
  IndexType AS = A.start(), AE = A.end();
  if (AS < start() || start() == IndexType::None)
    setStart(AS);
  if (end() < AE || end() == IndexType::None) {
    setEnd(AE);
    TiedEnd = A.TiedEnd;
  } else {
    if (end() == AE)
      TiedEnd |= A.TiedEnd;
  }
  if (A.Fixed)
    Fixed = true;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:16,代码来源:HexagonBlockRanges.cpp

示例7: span

IndexRange span(IndexRange lhs, IndexRange rhs) {
    if (lhs.start() <= lhs.end()) {
        if (rhs.start() <= rhs.end()) {
            const SINT start = std::min(lhs.start(), rhs.start());
            const SINT end = std::max(lhs.end(), rhs.end());
            DEBUG_ASSERT(start <= end);
            return IndexRange::between(start, end);
        } else {
            DEBUG_ASSERT(!"Cannot span index ranges with contrary orientations");
        }
    } else {
        if (rhs.start() >= rhs.end()) {
            const SINT start = std::max(lhs.start(), rhs.start());
            const SINT end = std::min(lhs.end(), rhs.end());
            DEBUG_ASSERT(start >= end);
            return IndexRange::between(start, end);
        } else {
            DEBUG_ASSERT(!"Cannot span index ranges with contrary orientations");
        }
    }
    return IndexRange();
}
开发者ID:DJMaxergy,项目名称:mixxx,代码行数:22,代码来源:indexrange.cpp


注:本文中的IndexRange::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。