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


C++ ProjectionPath::rbegin方法代码示例

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


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

示例1: rbegin

/// TODO: Integrate has empty non-symmetric difference into here.
SubSeqRelation_t
ProjectionPath::
computeSubSeqRelation(const ProjectionPath &RHS) const {
    // If either path is empty, we can not prove anything, return Unrelated.
    if (empty() || RHS.empty())
        return SubSeqRelation_t::Unrelated;

    // We reverse the projection path to scan from the common object.
    auto LHSReverseIter = rbegin();
    auto RHSReverseIter = RHS.rbegin();

    unsigned MinPathSize = std::min(size(), RHS.size());

    // For each index i until min path size...
    for (unsigned i = 0; i != MinPathSize; ++i) {
        // Grab the current projections.
        const Projection &LHSProj = *LHSReverseIter;
        const Projection &RHSProj = *RHSReverseIter;

        // If the two projections do not equal exactly, return Unrelated.
        //
        // TODO: If Index equals zero, then we know that the two lists have nothing
        // in common and should return unrelated. If Index is greater than zero,
        // then we know that the two projection paths have a common base but a
        // non-empty symmetric difference. For now we just return Unrelated since I
        // can not remember why I had the special check in the
        // hasNonEmptySymmetricDifference code.
        if (LHSProj != RHSProj)
            return SubSeqRelation_t::Unrelated;

        // Otherwise increment reverse iterators.
        LHSReverseIter++;
        RHSReverseIter++;
    }

    // Ok, we now know that one of the paths is a subsequence of the other. If
    // both size() and RHS.size() equal then we know that the entire sequences
    // equal.
    if (size() == RHS.size())
        return SubSeqRelation_t::Equal;

    // If MinPathSize == size(), then we know that LHS is a strict subsequence of
    // RHS.
    if (MinPathSize == size())
        return SubSeqRelation_t::LHSStrictSubSeqOfRHS;

    // Otherwise, we know that MinPathSize must be RHS.size() and RHS must be a
    // strict subsequence of LHS. Assert to check this and return.
    assert(MinPathSize == RHS.size() &&
           "Since LHS and RHS don't equal and size() != MinPathSize, RHS.size() "
           "must equal MinPathSize");
    return SubSeqRelation_t::RHSStrictSubSeqOfLHS;
}
开发者ID:fengweijp,项目名称:swift,代码行数:54,代码来源:Projection.cpp


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