>>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:
Abdelrazak> Hum the version I committed from JMarc used the
Abdelrazak> CursorSlice::operator<() which does not check for idx()
Abdelrazak> IIRC. Should add this test JMarc?
I double checked and it does check for idx. However, I see now that
any container implements lexicographic ordering tests. Question: would
the following patch make sense? Abdel, I know I have removed code
you just added, but I am wondering why we have to declare those extra
things. Also, it seems to me that the following could be removed:
/// test for inequality
bool operator!=(CursorSlice const &, CursorSlice const &);
/// test for order
bool operator>(CursorSlice const &, CursorSlice const &);
/// test for order
bool operator<=(CursorSlice const &, CursorSlice const &);
Andre', am I right?
JMarc
Index: src/DocIterator.cpp
===================================================================
--- src/DocIterator.cpp (révision 18363)
+++ src/DocIterator.cpp (copie de travail)
@@ -553,29 +553,6 @@ std::ostream & operator<<(std::ostream &
}
-bool operator<(DocIterator const & p, DocIterator const & q)
-{
- size_t depth = std::min(p.depth(), q.depth());
- for (size_t i = 0 ; i < depth ; ++i) {
- if (p[i] != q[i])
- return p[i] < q[i];
- }
- return p.depth() < q.depth();
-}
-
-
-bool operator>(DocIterator const & p, DocIterator const & q)
-{
- return q < p;
-}
-
-
-bool operator<=(DocIterator const & p, DocIterator const & q)
-{
- return !(q < p);
-}
-
-
///////////////////////////////////////////////////////
StableDocIterator::StableDocIterator(DocIterator const & dit)
Index: src/DocIterator.h
===================================================================
--- src/DocIterator.h (révision 18363)
+++ src/DocIterator.h (copie de travail)
@@ -213,9 +213,8 @@ public:
operator<<(std::ostream & os, DocIterator const & cur);
///
friend bool operator==(DocIterator const &, DocIterator const &);
+ ///
friend bool operator<(DocIterator const &, DocIterator const &);
- friend bool operator>(DocIterator const &, DocIterator const &);
- friend bool operator<=(DocIterator const &, DocIterator const &);
///
friend class StableDocIterator;
//protected:
@@ -266,13 +265,18 @@ bool operator==(DocIterator const & di1,
return di1.slices_ == di2.slices_;
}
-
inline
bool operator!=(DocIterator const & di1, DocIterator const & di2)
{
return !(di1 == di2);
}
+inline
+bool operator<(DocIterator const & di1, DocIterator const & di2)
+{
+ return di1.slices_ < di2.slices_;
+}
+
// The difference to a ('non stable') DocIterator is the removed
// (overwritten by 0...) part of the CursorSlice data items. So this thing