[Development] qMoveToConst helper for rvalue references to movable Qt containers?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Wed Oct 31 10:06:58 CET 2018


Il 29/10/18 13:00, André Hartmann ha scritto:
> Looking athttps://docs.kdab.com/analysis/qtcreator/clazy.html  gives
> currently 223 potential detaching containers within range-based for, and
> qtbase alone has 46 (https://docs.kdab.com/analysis/qt5/clazy.html).
> 
> Even if there may be some false positives, who is going to check and fix
> them all? If we don't manage to use the range-based for correctly (for
> Qt-containers), why should we force the user to port away from foreach?

Well, noone is forcing you to change those usages right now; updating 
old practices is something which is naturally part of maintaining a code 
base. And, yes, *we* get this stuff wrong all the time (... 
QList<QImage> anyone?). Luckily we now have something like clazy now, so 
we can prevent such mistakes from happening in the first place.

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20181031/71e9dd80/attachment.bin>


More information about the Development mailing list