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:
Tim Siebels 2017-10-01 15:55:47 +02:00 committed by xarkes
parent 7f71cace8e
commit ffa52bd3e8

View File

@ -128,7 +128,7 @@ public:
result += t.text;
}
}
return std::move(result);
return result;
}
};