On Tue, Feb 03, 2004 at 03:21:19PM +0100, Andre Poenitz spake thusly:
> 
> On Tue, Feb 03, 2004 at 04:12:09PM +0200, Martin Vermeer wrote:
> > 
> > This should work shouldn't it... the types derive from each other.
> > Current CVS, gcc 2.95 with stlport. Georg Baum reported something
> > similar earlier on.
> > 
> > What's up?
> 
> Maybe a const_cast helps.
> 
> Andre'

(gcc €%&#% error messages) 

It sure does help... pretty it is not.

Does it make sense to check this in (attached)?

- Martin

Index: math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.86
diff -u -p -r1.86 math_nestinset.C
--- math_nestinset.C    3 Feb 2004 08:56:28 -0000       1.86
+++ math_nestinset.C    3 Feb 2004 15:01:12 -0000
@@ -72,7 +72,7 @@ MathArray const & MathNestInset::cell(id
 void MathNestInset::getCursorPos(CursorSlice const & cur,
        int & x, int & y) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
        MathArray const & ar = cur.cell();
        x = ar.xo() + ar.pos2x(cur.pos());
        y = ar.yo();
@@ -102,7 +102,7 @@ void MathNestInset::metrics(MetricsInfo 
 
 bool MathNestInset::idxNext(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
        if (cur.idx() + 1 >= nargs())
                return false;
        ++cur.idx();
@@ -119,7 +119,7 @@ bool MathNestInset::idxRight(LCursor & c
 
 bool MathNestInset::idxPrev(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
        if (cur.idx() == 0)
                return false;
        --cur.idx();
@@ -136,7 +136,7 @@ bool MathNestInset::idxLeft(LCursor & cu
 
 bool MathNestInset::idxFirst(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
        if (nargs() == 0)
                return false;
        cur.idx() = 0;
@@ -147,7 +147,7 @@ bool MathNestInset::idxFirst(LCursor & c
 
 bool MathNestInset::idxLast(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
        if (nargs() == 0)
                return false;
        cur.idx() = nargs() - 1;
@@ -158,7 +158,7 @@ bool MathNestInset::idxLast(LCursor & cu
 
 bool MathNestInset::idxHome(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() ==  const_cast<MathNestInset *>(this));
        if (cur.pos() == 0)
                return false;
        cur.pos() = 0;
@@ -168,7 +168,7 @@ bool MathNestInset::idxHome(LCursor & cu
 
 bool MathNestInset::idxEnd(LCursor & cur) const
 {
-       BOOST_ASSERT(cur.inset() == this);
+       BOOST_ASSERT(cur.inset() ==  const_cast<MathNestInset *>(this));
        if (cur.lastpos() == cur.lastpos())
                return false;
        cur.pos() = cur.lastpos();
@@ -205,7 +205,7 @@ void MathNestInset::drawSelection(Painte
        LCursor & cur = pi.base.bv->cursor();
        if (!cur.selection())
                return;
-       if (cur.inset() != this)
+       if (cur.inset() !=  const_cast<MathNestInset *>(this))
                return;
        CursorSlice & s1 = cur.selBegin();
        CursorSlice & s2 = cur.selEnd();

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to