title: c++ XOR between bitsets
body: <pre><code>std::bitset &lt;1&gt; a1;
  std::bitset &lt;1&gt; a2;
  
  a1 = std::bitset&lt;1&gt; (0);
  a2 = std::bitset&lt;1&gt; (1);
  
  std::bitset&lt;1&gt; b = (a1 ^= a2)
  </code></pre>
  
  <p>This results in</p>
  
  <pre><code>b = 1
  </code></pre>
  
  <p>which is fine but modifies also a1, which after the XOR operation becomes:</p>
  
  <pre><code>a1 = 1
  </code></pre>
  
  <p>Why is this happening?
  How can I avoid this without creating <em>temp</em> variables?</p>