From: Adam C. Emerson Date: Mon, 10 Apr 2017 17:12:08 +0000 (-0400) Subject: rgw: Remove pessimizing move of return values X-Git-Tag: v12.0.2~94^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3c4811fad36a556e5a38539b753b3158b3d4c64b;p=ceph.git rgw: Remove pessimizing move of return values C++ performs copy elision of return values if: 1. The value is a local declared in the function (i.e. not a parameter) 2. The type of the value in the return statement is, modulo const-value qualification, identical to the return type of the function. An RValue reference to a type is not identical, modulo const-value qualification, to the type it is a reference to. Do not std::move local values in the return statement unless the value is a parameter or you will make the compiler perform a copy it would iotherwise avoid. Signed-off-by: Adam C. Emerson --- diff --git a/src/rgw/rgw_auth_s3.cc b/src/rgw/rgw_auth_s3.cc index f4b34e929e8..ed61d024a9e 100644 --- a/src/rgw/rgw_auth_s3.cc +++ b/src/rgw/rgw_auth_s3.cc @@ -57,7 +57,7 @@ get_canon_amz_hdr(const std::map& meta_map) dest.append("\n"); } - return std::move(dest); + return dest; } /* @@ -95,7 +95,7 @@ get_canon_resource(const char* const request_uri, } dout(10) << "get_canon_resource(): dest=" << dest << dendl; - return std::move(dest); + return dest; } /*