[phobos] swap()

Andrei Alexandrescu andrei at erdani.com
Sat Jan 1 15:42:44 PST 2011


This has been lying in my inbox for a good while. I see now the bug is 
fixed. Any trailing questions regarding it?

Andrei

On 9/2/10 10:58 PM, David Simcha wrote:
> A few questions about std.algorithm.swap() that came up when I was
> reading the code to fix Bug 4789:
>
> 1. Do we really need to use memcpy() for structs w/o a postblit? I can't
> see any advantages and it seems like it might be less efficient, since
> for a struct without a postblit just using plain old assignment should
> be about as efficient as it gets.
>
> 2. memcpy() isn't guaranteed to work for overlapping memory blocks.
> Shouldn't there be a check in to make sure a and b don't have the same
> address?
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list