On 08/01/2013 01:15 PM, Hashini Senaratne wrote:
+               BufferView & bv = cur.bv();
+

You are defining bv, whereas you already have bv_, which is a BufferView
const *. Advice: always check whether a variable is needed before
defining it.

However in this case the situation is different since you want a
non-const cursor. A way to have is is to get a non-const BufferView. It
often happens in such methods that extra data is provided in ancillary
parameters, in this case pi (PainterInfo).

In particular in pi you have pi.bv, which is a pointer to the buffer
view. Therefore you can change the definition of cur to
        Cursor & cur = pi.bv.cursor();
But I think changing the definition of cur is not suitable, because that
exists there and as its definition is like this: Cursor const & cur;
in this drawParagraph() method cur is used with most of the constant
methods. So, or else should we define another Cursor variable which is
non-constant?

I think what JMarc meant is that, if you need cur to be non-const in this method, then you should just make it non-const. It's confusing to be accessing the same object in two different ways.

That said, I don't really see myself why, in this particular commit, you would need a non-const cursor. But I've not followed this work very closely.

Richard

Reply via email to