mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-13 16:18:30 +00:00
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.
This commit is contained in:
parent
7f71cace8e
commit
ffa52bd3e8
@ -128,7 +128,7 @@ public:
|
||||
result += t.text;
|
||||
}
|
||||
}
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user