class MathUnknownInset;
class MathGridInset;
+
+// only needed for gcc 2.95, remove when support terminated
+
+
+template <typename A, typename B>
+bool ptr_cmp(A const * a, B const * b)
+{
+return a == b;
+}
+
+
// this is used for traversing math insets
typedef std::vector<CursorSlice> CursorBase;
/// move on one step
void MathNestInset::getCursorPos(CursorSlice const & cur,
int & x, int & y) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
MathArray const & ar = cur.cell();
x = ar.xo() + ar.pos2x(cur.pos());
y = ar.yo();
bool MathNestInset::idxNext(LCursor & cur) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
if (cur.idx() == cur.lastidx())
return false;
++cur.idx();
bool MathNestInset::idxPrev(LCursor & cur) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
if (cur.idx() == 0)
return false;
--cur.idx();
bool MathNestInset::idxFirst(LCursor & cur) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
if (nargs() == 0)
return false;
cur.idx() = 0;
bool MathNestInset::idxLast(LCursor & cur) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
if (nargs() == 0)
return false;
cur.idx() = cur.lastidx();
bool MathNestInset::idxHome(LCursor & cur) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
if (cur.pos() == 0)
return false;
cur.pos() = 0;
bool MathNestInset::idxEnd(LCursor & cur) const
{
- BOOST_ASSERT(cur.inset() == const_cast<MathNestInset *>(this));
+ BOOST_ASSERT(ptr_cmp(cur.inset(), this));
if (cur.lastpos() == cur.lastpos())
return false;
cur.pos() = cur.lastpos();
LCursor & cur = pi.base.bv->cursor();
if (!cur.selection())
return;
- if (cur.inset() != const_cast<MathNestInset *>(this))
+ if (!ptr_cmp(cur.inset(), this))
return;
CursorSlice & s1 = cur.selBegin();
CursorSlice & s2 = cur.selEnd();