title: Can a template function compare the two typenames?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2639557/program-to-implement-the-is-same-type-type-trait-in-c">Program to implement the is_same_type type trait in c++</a>  </p>
  </blockquote>
  
  
  
  <p>I want my template function to do something differently based on whether the two typenames are equal or not:</p>
  
  <pre><code>template &lt;typename T1, typename T2&gt; f()
  {
    if (T1==T2) ...;
    else ...;
  }
  </code></pre>
  
  <p>I know "if(T1==T2)" is not gonna working, but, is there a way to do it?</p>