[Development] QUIP 6: removing top-level const from return types

Ville Voutilainen ville.voutilainen at gmail.com
Tue May 23 11:17:32 CEST 2017


On 23 May 2017 at 12:00, Marc Mutz <marc.mutz at kdab.com> wrote:
>> Maybe, but I have some questions: the review for removing top-level consts
>> from QRegion says "It has no effect and inhibits move semantics." How does
>> it inhibit move semantics? How is this even a SiC? What _positive_ impact
>> do these changes have?
>
> See Olivier's example:
>
>    QPixmap pix;
>    pix = splash.pixmap();
>
> with
>
>    const QPixmap pixmap() const;
>
> calls the copy assignment operator, while with
>
>    QPixmap pixmap() const;
>
> it calls, as expected, the _move_ assignment operator.

Ok, yeah, I was using constructors, not assignment operators so I
failed to see the
issue.

So, we are doing this to improve performance of otherwise valid code,
but not making this
change doesn't make anything worse, right?



More information about the Development mailing list