Re:But I was helping the compiler
by iainmerrick on Friday August 21, 2020 @02:04PM
(#24237324)
But shouldn’t those extra calls be optimized away to nothing, if they don’t have any real side-effects? That’s what I would naively assume.
Re:But I was helping the compiler
by edflsafoiewq on Friday August 21, 2020 @02:09PM
(#24237357)
I expect so, yes.
In the version with std::move, it first copy-elides the function call into a temporary, then move-constructs the disp_pixels object from the temporary. ie as if
So the version with std::move is invoking an extra move-constructor and destructor call.