Scott Kostyshak schreef op 22-4-2015 om 3:37:
My question is in regards to the patch I propose for #6173:
http://www.lyx.org/trac/attachment/ticket/6173/0001-Update-previews-when-going-to-a-bookmark-6173.patch
I move the definition of cur up because I need it before the return. I
then need to pass it to notifyCursorLeavesOrEnters(), which requires
it not to be const, so I removed the const in the definition. But what
should I do? Alternatives to what I did are: (b) use a different
definition, cur2, and leave cur alone. (c) use a const cast in the
call to notifyCursorLeavesOrEnters()?
Is there a clear correct way?
In many cases variables are defined const because they are not going to
be changed. This does not mean that it was not allowed to be changed by
design.
In this case, I would just remove the const.
Vincent