Re:But I was helping the compiler
by qppo on Saturday August 22, 2020 @01:40AM
(#24241880)
No I meant that the only difference between a move and a copy under the hood is that the compiler can assume the destination memory overlaps the source. If the struct is large that might mean using a memmove instead of memcpy.
I don't think aliasing the this pointer matters, since it's the pointed-to memory that could be aliased.
But I'm not sure if that's actually faster or if any compiler utilizes the semantic difference.
I don't think aliasing the this pointer matters, since it's the pointed-to memory that could be aliased.
But I'm not sure if that's actually faster or if any compiler utilizes the semantic difference.