title: How to bitwise operate on memory block (C++)
body: <p>Is there a better (faster/more efficient) way to perform a bitwise operation on a large memory block than using a for loop? After looking it to options I noticed that std has a member <code>std::bitset</code>, and was also wondering if it would be better (or even possible) to convert a large region of memory into a bitset without changing its values, then perform the operations, and then switch its type back to normal? </p>
  
  <p>Edit / update: I think <code>union</code> might apply here, such that the memory block is allocated a <code>new</code> array of <code>int</code> or something and then manipulated as a large <code>bitset</code>. Operations seem to be able to be done over the entire set based on what is said here: <a href="http://www.cplusplus.com/reference/bitset/bitset/operators/" rel="noreferrer">http://www.cplusplus.com/reference/bitset/bitset/operators/</a> .</p>