title: When can I use explicit operator bool without a cast?
body: <p>My class has an explicit conversion to bool:</p>
  
  <pre><code>struct T {
      explicit operator bool() const { return true; }
  };
  </code></pre>
  
  <p>and I have an instance of it:</p>
  
  <pre><code>T t;
  </code></pre>
  
  <p>To assign it to a variable of type <code>bool</code>, I need to write a cast:</p>
  
  <pre><code>bool b = static_cast&lt;bool&gt;(t);
  bool b = bool(t);
  bool b(t);  // converting initialiser
  bool b{static_cast&lt;bool&gt;(t)};
  </code></pre>
  
  <p>I know that I can use my type directly in a conditional without a cast, despite the <code>explicit</code> qualifier:</p>
  
  <pre><code>if (t)
      /* statement */;
  </code></pre>
  
  <p>Where else can I use <code>t</code> as a <code>bool</code> without a cast?</p>