title: Bitset in C++, about continuously add
body: <p>I want to add 1 value to the bitset until it over flows, I am wondering how to do this, like:</p>
  
  <p>bitset&lt;20> foo;   (foo=00000 00000 00000 00000)
  how can we implement this function, continuously add one</p>
  
  <blockquote>
    <p>00000 00000 00000 00000 00000 > 00000 00000 00000 00000 00001 > 00000 00000 00000 00000 >00010 > 00000 00000 00000 00000 000011  until it overflows?</p>
  </blockquote>
  
  <p>I am thinking about two ways;</p>
  
  <pre><code>foo.to_ulong();
  </code></pre>
  
  <p>how to convert unsigned long back to bitset again? C++ documentation indicates it is possible, but in the library, I can only see bitset (unsigned long val), which is creating a new bitset</p>
  
  <p>2.
  somehow bit operations, both got stuck, help needed</p>