title: Convert a std::vector<boost::optional<double>> to a std::vector<double>
body: <p>I have a <code>std::vector&lt;boost::optional&lt;double&gt;&gt;</code>, <code>foo</code> say. In this particular instance I need a <code>std::vector&lt;double&gt;</code> where any "optional" element in the other vector maps to a 0 in the new one.</p>
  
  <p>Am I missing a one-line solution for this?</p>
  
  <p>The other choice is the unsatisfactory</p>
  
  <pre><code>std::vector&lt;double&gt; out(foo.size());
  for (auto&amp; it : foo){
      out.push_back(it ? *it : 0.0);
  }
  </code></pre>
  
  <p>I'd welcome a solution based on <code>std::optional</code>, even though I don't use that standard yet.</p>