[Development] Move assignment without move constructors

Konstantin Tokarev annulen at yandex.ru
Mon May 23 19:50:18 CEST 2016



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.

>
> Cf. the "Move ctors for q_declare_shared types" thread we had some time
> ago, and https://codereview.qt-project.org/#/c/115213/ .
>
> Cheers,
> --
> Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
> KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
> KDAB - The Qt Experts
>
> ,
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-- 
Regards,
Konstantin



More information about the Development mailing list