title: C++ "if then else" template substitution
body: <p>I would like to declare a template as follows:</p>
  
  <pre><code>template &lt;typename T&gt;
  { 
    if objects of class T have method foo(), then 
     const int k=1
    else 
     if class has a static const int L then
      const int k=L
     else 
      const int k=0;
  
  
  }
  </code></pre>
  
  <p>How can I do this? In general, I would like a mechanism for setting static consts
  based on properties of T (or typedef defined inside T).</p>