Detecting matching bits in C++ : <p>I'm trying to take two <code>bitset</code> objects, for example </p>

<pre><code>a = 10010111
b = 01110010
</code></pre>

<p>and remove bits from both variables if they match in the same position/index. So we'd be left with</p>

<pre><code>a = 100xx1x1 = 10011
b = 011xx0x0 = 01100
</code></pre>

<p>Is there any way to achieve this?</p>
