af8f9a2a6e
The idea is to store a concatenable in a QStringBuilder object by value or by reference, depending on how it was originally passed into the concatenation operator. So if it was passed by r-value, we treat it as a temporary object and hold it by value (and use move-semantic if available), otherwise we hold it by reference (as before). To achieve this we first change concatenation operators '%' and '+' to take their arguments by universal reference. Next we instantiate QStringBuilder object with deduced types of the arguments, which will be a "value type" or a "reference type" according to "universal reference deduction rules". Further we use perfect forwarding to pass arguments to QStringBuilder's constructor. Thus arguments, initially passed by r-value reference and which are move-constructible, will be "moved" to corresponding QStringBuilder member variables. So, to summarize: 1. Arguments passed by l-value reference - stored in QStringBuilder object by reference (as before). 2. Temporary objects passed by r-value reference - stored in QStringBuilder object by value. If a type is move-constructible (QSting, QByteArray, etc), the object will be "moved" accordingly. Special thanks to Giuseppe D'Angelo for the tests. Fixes: QTBUG-99291 Fixes: QTBUG-87603 Fixes: QTBUG-47066 Task-number: QTBUG-74873 Task-number: QTBUG-103090 Task-number: QTBUG-104354 Change-Id: I64f417be0de0815ec5ae7e35a1cc6cef6d887933 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> |
||
---|---|---|
.. | ||
auto | ||
baseline | ||
benchmarks | ||
global | ||
libfuzzer | ||
manual | ||
shared | ||
testserver | ||
CMakeLists.txt | ||
README |
This directory contains autotests and benchmarks based on Qt Test. In order to run the autotests reliably, you need to configure a desktop to match the test environment that these tests are written for. Linux X11: * The user must be logged in to an active desktop; you can't run the autotests without a valid DISPLAY that allows X11 connections. * The tests are run against a KDE3 or KDE4 desktop. * Window manager uses "click to focus", and not "focus follows mouse". Many tests move the mouse cursor around and expect this to not affect focus and activation. * Disable "click to activate", i.e., when a window is opened, the window manager should automatically activate it (give it input focus) and not wait for the user to click the window.