qt5base-lts/tests/auto/corelib/tools/qstringapisymmetry
Marc Mutz e0ea0f6178 QChar: optimize comparison with QString{,Ref}
Instead of relying on the QString relational operators to
implicitly convert the QChar to a QString, add relational
operator overloads that compare the QChar without first
turning it into a QString, saving one memory allocation
per comparison, and allowing to mark the operation as
nothrow.

Consequently, in tst_QStringBinOps, verify now that all
relational operations are noexcept.

The added overloads make QChar ==/!= int comparisons
ambiguous. De-ambiguate by providing a constrained
template that matches int and nothing but int (otherwise,
the QChar and the int versions would compete for a
QChar::SpecialCharacter argument, and end up creating
new ambiguities). This solution may not be perfect, but
it can be easily extended should more ambiguities crop up.
The existing overload deals with all patterns found in
qtbase.

Change-Id: I4156d918e9b9134c1da684b8b69e0ee526ad24e3
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-05 19:47:37 +00:00
..
.gitignore Add test for API symmetry of QString/Ref, QLatin1String, QChar 2016-03-15 08:11:35 +00:00
qstringapisymmetry.pro Add test for API symmetry of QString/Ref, QLatin1String, QChar 2016-03-15 08:11:35 +00:00
tst_qstringapisymmetry.cpp QChar: optimize comparison with QString{,Ref} 2016-04-05 19:47:37 +00:00