title: C++ STL type_traits question
body: <p>I was watching the latest <a href="http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Standard-Template-Library-STL-10-of-10" rel="noreferrer">C9 lecture</a> and noticed something interesting..</p>
  
  <p>In his introduction to type_traits, Stephan uses the following (as he says, contrived) example:
  <pre><code>template <code>&lt;typename T&gt;</code> void foo(T t, true_type)
  {
      std::cout &lt;&lt; t &lt;&lt; " is integral";
  }
  template <code>&lt;typename T&gt;</code> void foo(T t, false_type)
  {
      std::cout &lt;&lt; t &lt;&lt; " is not integral";
  }</p>
  
  <p>template <code>&lt;typename T&gt;</code> void bar(T t)
  {
      foo(t, typename <code>is_integral&lt;T&gt;::type()</code>);
  }
  </pre></code></p>
  
  <p>This seems to be far more complicated than:</p>
  
  <p><pre><code>template <code>&lt;typename T&gt;</code> void foo(T t)
  {
      if(<code>std::is_integral&lt;T&gt;::value</code>)
          std::cout &lt;&lt; "integral";
      else
          std::cout &lt;&lt; "not integral";
  }
  </pre></code></p>
  
  <p>Is there something wrong with the latter way of doing it? Is his way better? Why?</p>
  
  <p>Thanks.</p>