Andre Poenitz wrote:
The canonical solution wold look like the following (completely
untested!)

bool operator<(DocIterator const & di1, DocIterator const & di2)
{
        size_t const n1 = di1.slices_.size();
        size_t const n2 = di2.slices_.size();
        for (size_t i = 0; i < n1 && i < n2; ++i) {
                Slice const & sl1 = di1.slices_[i];
                Slice const & sl2 = di2.slices_[i];
                if (sl1.idx() != sl2.idx())
                        return sl1.idx() < sl2.idx();

Hum the version I committed from JMarc used the CursorSlice::operator<() which does not check for idx() IIRC. Should add this test JMarc?

Abdel.

                if (sl1.pit() != sl2.pit())
                        return sl1.pit() < sl2.pit()
                if (sl1.pos() != sl2.pos())
                        return sl1.pos() < sl2.pos()
        }
        return n1 < n2;
}

bool operator<=(DocIterator const & di1, DocIterator const & di2)
{
        return !(di2 < di1);
}


Reply via email to