From ffa52bd3e8a7581f17b694d542bed49af53f3762 Mon Sep 17 00:00:00 2001 From: Tim Siebels Date: Sun, 1 Oct 2017 15:55:47 +0200 Subject: [PATCH] Fix pessimizing move (#19) moving a return value generally is unnecessary, as it prevents return value optimization. The standard defines, that (named) return value optimization, i.e. copy elision is only possible when returning a value from a non-volatile automatic object or when it's a temporary that has not been bound to a reference. (N)RVO is not possible when wrapping it with std::move, because the compiler is not allowed to do copy elision from arbitrary function calls. I think this was the intended purpose of this code. Also, it is cleaner. --- src/widgets/DisassemblerGraphView.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/DisassemblerGraphView.h b/src/widgets/DisassemblerGraphView.h index 05968b57..6971f497 100644 --- a/src/widgets/DisassemblerGraphView.h +++ b/src/widgets/DisassemblerGraphView.h @@ -128,7 +128,7 @@ public: result += t.text; } } - return std::move(result); + return result; } };