title: Why are the bits of a std::bitset in reverse order?
body: <p>Why does bitset store the bits in reverse order? After strugging many times I have finally written this binary_to_dec. Could it simplified?</p>
  
  <pre><code>int binary_to_dec(std::string bin)
  {
      std::bitset&lt;8&gt; bit;
  
      int c = bin.size();
  
      for (size_t i = 0; i &lt; bin.size(); i++,c--)
      {
          bit.set(c-1, (bin[i]-'0' ? true : false));
      }
  
      return bit.to_ulong();
  }
  </code></pre>