I think swap will be more efficient than memcpy for smaller objects because it does not use a loop. For bigger objects, locality of reference will make memcpy execute faster.