diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-06 11:01:48 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-06 12:29:37 (GMT) |
commit | 0a4f6af142c57929bd743f3e95e25ada8642e9e4 (patch) | |
tree | 496b274cc44f6fe821a557e5f26d96cbf6837668 /src/corelib/tools/qstring.h | |
parent | 3c400bdd727af5feebd1f514b2509f40250acd34 (diff) | |
download | Qt-0a4f6af142c57929bd743f3e95e25ada8642e9e4.zip Qt-0a4f6af142c57929bd743f3e95e25ada8642e9e4.tar.gz Qt-0a4f6af142c57929bd743f3e95e25ada8642e9e4.tar.bz2 |
QStringBuilder: add operator += for QString and QByteArray
Optimize cases when we have.
string += someString + someOtherString
Avoid the allocation of one temporary string.
Behaviour change:
byteArray += someString + QByteArray("foo\0bar", 7)
before, the array would end at foo because of the conversion to string
Reviewed-by: hjk
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r-- | src/corelib/tools/qstring.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index b54258f..002e516 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -485,6 +485,9 @@ public: const_iterator constEnd() const; // STL compatibility + typedef const QChar & const_reference; + typedef QChar & reference; + typedef QChar value_type; inline void push_back(QChar c) { append(c); } inline void push_back(const QString &s) { append(s); } inline void push_front(QChar c) { prepend(c); } |