title: Conversion of boost::optional to bool
body: <p>How I can prevent the last line of this code from compiling?</p>
  
  <pre><code>#include &lt;boost/optional.hpp&gt;
  
  int main()
  {
      typedef boost::optional&lt;int&gt; int_opt;
      int_opt opt = 0;
      bool x = opt;  // &lt;- I do not want this to compile
  }
  </code></pre>
  
  <p>The last line doesn't examine <code>opt</code>'s contained int value, but instead compiles as a type conversion to bool, and doesn't seem to be what the user intended.</p>
  
  <p>The safe bool idiom seems to be relevant here?</p>