title: Recognize that a value is bool in a template
body: <p>This short C++17 program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  template &lt;typename T&gt; void output(T x)
  {
      if constexpr (std::is_integral&lt;decltype(x)&gt;::value) {
          std::cout &lt;&lt; static_cast&lt;int&gt;(x) &lt;&lt; " is integral" &lt;&lt; std::endl;
      } else {
          std::cout &lt;&lt; x &lt;&lt; " is not integral" &lt;&lt; std::endl;
      }
  }
  
  int main()
  {
      char x = 65;
      output(x);
  
      bool t = true;
      output(t);
  
      return 0;
  }
  </code></pre>
  
  <p>Has this output:</p>
  
  <pre><code>65 is integral
  1 is integral
  </code></pre>
  
  <p>In the template function named <code>output</code>, how can one detect that the argument <code>x</code> is boolean and not a number?</p>
  
  <p>The plan is to output the value with <code>std::cout &lt;&lt; std::boolalpha &lt;&lt;</code>, but only if the type is <code>bool</code>.</p>