bool operator< ( const CDictionaryBasedTempPath& lhs
               , const CDictionaryBasedTempPath& rhs)
{
    // both elements should be from the same container
    // (otherwise, some shortcuts may not be justified)

    assert (lhs.GetDictionary() == rhs.GetDictionary());

    // quick compare: indices and counters

    ptrdiff_t diff = lhs.GetBasePath().GetIndex() - rhs.GetBasePath().GetIndex();
    if (diff < 0)
        return true;
    if (diff > 0)
        return false;

    diff = lhs.GetRelPathElements().size() - rhs.GetRelPathElements().size();
    if (diff < 0)
        return true;
    if (diff > 0)
        return false;

    // long and boring comparison

    return lhs.GetRelPathElements() < rhs.GetRelPathElements();
}
예제 #2
0
CLogIteratorBase::CLogIteratorBase ( const CCachedLogInfo* cachedLog
                                   , revision_t startRevision
                                   , const CDictionaryBasedTempPath& startPath)
    : revisionInfo (cachedLog->GetLogInfo())
    , revisionIndices (cachedLog->GetRevisions())
    , skipRevisionInfo (cachedLog->GetSkippedRevisions())
    , revision (startRevision)
    , addRevision ((revision_t)NO_REVISION)
    , path (startPath)
    , addPath (startPath.GetDictionary())
{
}