I need an operator!=() for LyXLength in order to get insettabular.C to compile. The patch, attached, has the necessary code.
It looks to like g++ (I presume that the code compiles with g++ withouththis modification) generates an operator!=() function automatically if it has the appropriate operator==() function. Is this so, and is it standard C++? Regards, Angus cxx -std strict_ansi -nocleanup -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ -I../.. -I../.. -I../../boost -I../../src/cheaders -I/usr/local/include -msg_display_number -msg_disable 11,193,236,261,401,611 -w0 -ptr /usr/users/aleem/OTHERS_CODE/lyx/devel/lyx_cxx_repository -O2 -MD -c insettabular.C cxx: Error: insettabular.C, line 1692: #349 no operator "!=" matches these operands operand types are: const LyXLength != const LyXLength bool const update = (tabular->GetColumnPWidth(actcell) != vallen); cxx: Error: insettabular.C, line 1706: #349 no operator "!=" matches these operands operand types are: const LyXLength != const LyXLength bool const update = (tabular->GetPWidth(actcell) != vallen);
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.456 diff -u -p -r1.456 ChangeLog --- src/ChangeLog 2001/12/12 09:55:59 1.456 +++ src/ChangeLog 2001/12/12 11:30:40 @@ -1,3 +1,7 @@ +2001-12-12 Angus Leeming <[EMAIL PROTECTED]> + + * lyxlength.[Ch]: add an operator!=() function. + 2001-12-12 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * text.C (workWidth): use Inset::parOwner to find out where the Index: src/lyxlength.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlength.C,v retrieving revision 1.6 diff -u -p -r1.6 lyxlength.C --- src/lyxlength.C 2001/12/05 08:50:13 1.6 +++ src/lyxlength.C 2001/12/12 11:30:41 @@ -111,3 +111,9 @@ bool operator==(LyXLength const & l1, Ly { return l1.value() == l2.value() && l1.unit() == l2.unit(); } + + +bool operator!=(LyXLength const & l1, LyXLength const & l2) +{ + return !(l1 == l2); +} Index: src/lyxlength.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlength.h,v retrieving revision 1.2 diff -u -p -r1.2 lyxlength.h --- src/lyxlength.h 2001/12/05 08:04:14 1.2 +++ src/lyxlength.h 2001/12/12 11:30:41 @@ -98,6 +98,8 @@ private: /// bool operator==(LyXLength const & l1, LyXLength const & l2); /// +bool operator!=(LyXLength const & l1, LyXLength const & l2); +/// bool isValidLength(string const & data, LyXLength * result); /// char const * stringFromUnit(int unit);