[Development] Move assignment without move constructors

Allan Sandfeld Jensen kde at carewolf.com
Mon May 23 20:33:56 CEST 2016


On Monday 23 May 2016, Konstantin Tokarev wrote:
> 23.05.2016, 19:25, "Giuseppe D'Angelo" <giuseppe.dangelo at kdab.com>:
> > Il 23/05/2016 18:11, Konstantin Tokarev ha scritto:
> >>  Hello,
> > 
> >>  I've stumbled upon QPixmap having operator=(QPixmap&&) but missing 
QPixmap(QPixmap&&), however it seems like there are a lot of Qt classes in the 
same situation, for example:
> > [snip]
> > 
> >>  Is there any good reason for these classes to not have move
> >> constructor, or is it just an unfortunate omission?
> > 
> > Because the implementation of a move constructor for those classes
> > requires the private class to be defined in the public header, but all
> > those classes are pimpl'd, so by definition you don't have that private
> > class available.
> 
> Copy constructors are not defined in headers, so  don't see any reason for
> move constructors to be inline. And if those move constructors are defined
> in .cpp files, it should not be needed to include private headers into
> public.
> 
The problem is/was that C++11 support was optional before Qt 5.7, and that an 
application could use C++11 for itself but use a Qt version compiled without 
C++11. This meant they had to be binary compatible, and therefore any C++11  
specific methods had to be defined inline in the Qt headers.

As Thiago said, this should be something we could finally solve now in 5.7 or 
5.8.

Regards
`Allan



More information about the Development mailing list