[LLVMdev] Deduplication of memory allocation
fayard.francois at icloud.com
Fri May 1 09:01:52 PDT 2015
Of course, the allocation only occurs only once in every loop in the first example, inside the f function. We have 2 copy elision happening: one when the function returns and one when w is copy constructed. But we still have one memory allocation inside f.
With reference semantics, we don’t have a single memory allocation in the i-loop.
> On 01 May 2015, at 17:48, Daniel Berlin <dberlin at dberlin.org> wrote:
> Look up "Return value optimization".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev