From 8cee6864c6718449e3b5bedcd79173391ec188e7 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 8 Jul 2016 10:45:51 +0200 Subject: [PATCH] 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 --- src/corelib/tools/qstringbuilder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(this); } + T resolved() const { return *static_cast(this); } }; template