summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-02-19 11:26:32 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-02-21 15:44:28 (GMT)
commit4d3ca81b0aeef6f6496f3e89451f5369ce5efa99 (patch)
tree2842e950ce0caab7898a4440a2db995a07879977 /src/corelib
parent627a80020e460e844720f19d07dde9c168b500fc (diff)
downloadQt-4d3ca81b0aeef6f6496f3e89451f5369ce5efa99.zip
Qt-4d3ca81b0aeef6f6496f3e89451f5369ce5efa99.tar.gz
Qt-4d3ca81b0aeef6f6496f3e89451f5369ce5efa99.tar.bz2
QStringBuilder: reduce the size of the generated code
A simple concatenation of 2 string does not benefit from the QStringBuilder trick, yet, this would produce more code with QT_USE_FAST_OPERATOR_PLUS This commit specialize the QStringBuilder with two QString so it produce the same code as without it. Reviewed-by: joao Reviewed-by: hjk
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qstringbuilder.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 74661c2..4ff1b36 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -117,6 +117,20 @@ public:
};
+template <>
+class QStringBuilder <QString, QString>
+{
+ public:
+ QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {}
+
+ operator QString() const
+ { QString r(a); r += b; return r; }
+ QByteArray toLatin1() const { return QString(*this).toLatin1(); }
+
+ const QString &a;
+ const QString &b;
+};
+
template <> struct QConcatenable<char> : private QAbstractConcatenable
{
typedef char type;