We should not have hacks like this...

== should always check for "value equality" not "object equality" in a
value-based world (like STL...)

Andre'

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)
Index: paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.298
diff -u -p -r1.298 paragraph.C
--- paragraph.C 31 Jul 2003 13:12:20 -0000      1.298
+++ paragraph.C 31 Jul 2003 13:29:36 -0000
@@ -1116,7 +1116,7 @@ bool Paragraph::isMultiLingual(BufferPar
        for (; cit != end; ++cit)
                if (cit->font().language() != ignore_language &&
                    cit->font().language() != latex_language &&
-                       cit->font().language() != doc_language)
+                   cit->font().language() != doc_language)
                        return true;
        return false;
 }
@@ -1364,13 +1364,6 @@ bool Paragraph::allowEmpty() const
        if (layout()->keepempty)
                return true;
        if (pimpl_->inset_owner && pimpl_->inset_owner->owner())
-               return (pimpl_->inset_owner->owner()->lyxCode() == InsetOld::ERT_CODE);
+               return pimpl_->inset_owner->owner()->lyxCode() == InsetOld::ERT_CODE;
        return false;
-}
-
-
-bool operator==(Paragraph const & lhs, Paragraph const & rhs)
-{
-#warning FIXME this implementatoin must be completely wrong...
-       return &lhs == &rhs;
 }
Index: paragraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v
retrieving revision 1.92
diff -u -p -r1.92 paragraph.h
--- paragraph.h 31 Jul 2003 13:12:21 -0000      1.92
+++ paragraph.h 31 Jul 2003 13:29:36 -0000
@@ -319,7 +319,4 @@ inline bool isDeletedText(Paragraph cons
        return par.lookupChange(pos) == Change::DELETED;
 }
 
-
-bool operator==(Paragraph const & lhs, Paragraph const & rhs);
-
 #endif // PARAGRAPH_H
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.399
diff -u -p -r1.399 text.C
--- text.C      29 Jul 2003 10:00:50 -0000      1.399
+++ text.C      31 Jul 2003 13:29:37 -0000
@@ -150,9 +150,12 @@ int LyXText::workWidth() const
 
 int LyXText::workWidth(InsetOld const * inset) const
 {
-       ParagraphList::iterator par = std::find(ownerParagraphs().begin(),
-                                               ownerParagraphs().end(),
-                                               *inset->parOwner());
+       ParagraphList::iterator par = ownerParagraphs().begin();
+       ParagraphList::iterator end = ownerParagraphs().end();
+       for ( ; par != end; ++par)
+               if (&*par == inset->parOwner())
+                       break;
+
        if (par == ownerParagraphs().end()) {
                lyxerr << "LyXText::workWidth: unexpected\n";
                return -1;
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.406
diff -u -p -r1.406 text2.C
--- text2.C     31 Jul 2003 12:25:36 -0000      1.406
+++ text2.C     31 Jul 2003 13:29:37 -0000
@@ -1101,19 +1101,23 @@ void LyXText::setCounter(Buffer const * 
 
                // the caption hack:
                if (layout->labeltype == LABEL_SENSITIVE) {
+                       ParagraphList::iterator end = ownerParagraphs().end();
                        ParagraphList::iterator tmppit = pit;
                        InsetOld * in = 0;
                        bool isOK = false;
-                       while (tmppit != ownerParagraphs().end() &&
-                              tmppit->inInset()
+                       while (tmppit != end && tmppit->inInset()
                               // the single '=' is intended below
-                              && (in = tmppit->inInset()->owner())) {
+                              && (in = tmppit->inInset()->owner()))
+                       {
                                if (in->lyxCode() == InsetOld::FLOAT_CODE ||
                                    in->lyxCode() == InsetOld::WRAP_CODE) {
                                        isOK = true;
                                        break;
                                } else {
-                                       tmppit = std::find(ownerParagraphs().begin(), 
ownerParagraphs().end(), *in->parOwner());
+                                       tmppit = ownerParagraphs().begin();
+                                       for ( ; tmppit != end; ++tmppit)
+                                               if (&*tmppit == in->parOwner())
+                                                       break;
                                }
                        }
 

Reply via email to