On Wed, Feb 04, 2004 at 09:50:36AM +0200, Martin Vermeer wrote: > BTW a general question: if the number of 'const' keywords in the code > increases, does that tend to make the code better?
Usually, yes. Of course not, if the 'const' is const_cast'ed away afterwards. > Index: cursor_slice.C > =================================================================== > RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor_slice.C,v > retrieving revision 1.13 > diff -u -p -r1.13 cursor_slice.C > --- cursor_slice.C 2 Feb 2004 11:56:50 -0000 1.13 > +++ cursor_slice.C 4 Feb 2004 07:05:48 -0000 > @@ -34,7 +34,7 @@ CursorSlice::CursorSlice() > {} > > > -CursorSlice::CursorSlice(InsetBase * p) > +CursorSlice::CursorSlice(InsetBase const * p) > : inset_(p), idx_(0), par_(0), pos_(0), boundary_(false) > { > [...] > /// pointer to an inset > - InsetBase * inset_; > + InsetBase const * inset_; That's conceptionally wrong. Our insets _are_ modifiable. We can't stored just immutable ones. > /// Delete a cell and move cursor > - virtual bool idxDelete(idx_type &) { return false; } > + virtual bool idxDelete(idx_type &) const { return false; } > /// pulls cell after pressing erase > - virtual void idxGlue(idx_type) {} > + virtual void idxGlue(idx_type) const {} > // returns list of cell indices that are "between" from and to for > // selection purposes > virtual bool idxBetween(idx_type idx, idx_type from, idx_type to) const; > @@ -155,7 +155,7 @@ public: > /// number of columns in gridlike structures > virtual size_t ncols() const { return 0; } > /// is called when the cursor leaves this inset > - virtual void notifyCursorLeaves(idx_type) {} > + virtual void notifyCursorLeaves(idx_type) const {} NO! The whole idea of these functions is to modify the insets logically. They mustn't be const. 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...)