mirror of
https://github.com/ceph/ceph
synced 2024-12-18 09:25:49 +00:00
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 <aemerson@redhat.com>
This commit is contained in:
parent
5b517ad4cf
commit
3c4811fad3
@ -57,7 +57,7 @@ get_canon_amz_hdr(const std::map<std::string, std::string>& 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user