One Response

  1. Ider
    Ider May 1, 2013 at 1:56 pm |

    Xor operation is not good for swap, especially on array elements. Although it looks very fancy.

    I have written a post that talking about the issue: Xor Swap Issue

    For Performance purpose and correctness, it’s better to use simplest swap with third temporary variable. Or just call swap function in C++ library.

    Reply

Leave a Reply