diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-07-08 10:45:51 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-07-11 13:57:51 +0000 |
commit | 8cee6864c6718449e3b5bedcd79173391ec188e7 (patch) | |
tree | f53fcfadb9597d3d40536704dacc660760317cc9 /src/corelib/tools/qstringbuilder.h | |
parent | e27c07389bcf8b6c5cc1c356a3ee1759045270a8 (diff) |
QStringBuilderCommon: drop const from resolved() result type
The const qualification prevented toUpper() etc from
calling the rvalue overloads of the corresponding QString
functions. Since resolved() always returns a non-shared
object, the rvalue overloads can re-use the object's
capacity for storing their result, saving up to one memory
allocation per QStringBuilderCommon::to*() invocation.
Change-Id: Ica97fcd906cdd949ffe56055654578b93407e2d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qstringbuilder.h')
-rw-r--r-- | src/corelib/tools/qstringbuilder.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 69bd344f47..fdd1aa3478 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -76,7 +76,7 @@ struct QStringBuilderCommon T toLower() const { return resolved().toLower(); } protected: - const T resolved() const { return *static_cast<const Builder*>(this); } + T resolved() const { return *static_cast<const Builder*>(this); } }; template<typename Builder, typename T> |