title: Convert vector<bool> to binary
body: <p>I have a <code>vector&lt;bool&gt;</code> that contains 10 elements. How can I convert it to a binary type;</p>
  
  <pre><code>vector&lt;bool&gt; a={0,1,1,1,1,0,1,1,1,0}
  </code></pre>
  
  <p>I want to get binary values, something like this:</p>
  
  <pre><code>long long int x = convert2bin(s)
  cout &lt;&lt; "x = " &lt;&lt; x &lt;&lt; endl
  </code></pre>
  
  <p>x = 0b0111101110</p>
  
  <p>Note: the size of vector will be change during run time, max size = 400.</p>
  
  <p><code>0b</code> is important, I want to use the gcc extension, or some literal type. </p>