News for hackers. Stuff that matters.
Re:But I was helping the compiler by edflsafoiewq on Friday August 21, 2020 @01:17PM (#24236871)
The version without std::move does not call a constructor because of copy elision. The get_display_pixels function constructs the disp_pixels object in place.

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

    auto tmp = emulator.get_display_pixels();
    const auto disp_pixels = std::move(tmp); // move constructor called here
    // lifetime of tmp ends
So the version with std::move is invoking an extra move-constructor and destructor call.
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.