[LyX/master] use std::move() instead of copying when value is no longer used

Pavel Sanda sanda at lyx.org
Tue Sep 10 13:01:02 UTC 2024


On Sat, Sep 07, 2024 at 01:22:53PM +0200, Jean-Marc Lasgouttes wrote:
> Le 07/09/2024 ?? 12:52, Juergen Spitzmueller a écrit :
> > commit e685d31f5aadadd9c84c80a604818d49f5853dbf
> > Author: Juergen Spitzmueller <spitz at lyx.org>
> > Date:   Sat Sep 7 12:50:27 2024 +0200
> > 
> >      use std::move() instead of copying when value is no longer used
> >      This is mainly to shut down coverity which nowadays nags on this.
> >      I am not sure whether we really gain something in these cases.
> > ---
> 
> I have been resisting to making these changes because someone may change the
> code and use the variable afterwards. But I may be wrong after all.

I find that std::move construct make the readbility worse for me. Not seeing it
on the left side of the assignment makes it easy to overlook that the variable
might be actually empty after move and use it in the subsequent code later.

Unless we are optimizing for speed in some critical section I would prefer
to use the old inefficient way...

Pavel


More information about the lyx-devel mailing list