title: find typename of typename in template parameter
body: <p>I would like the following code to compile when foo gets anything derived from base, otherwise a compile error ensues. I have written the type-trait class is_Base because the <code>std::is_base_of</code> does not work well with my template stuff. I am close. I got it to work using a <code>static_passoff</code> thing, but I would like to not have to use it. So how can write the enable_if without the <code>static_passoff</code> hack? Here is the running version: <a href="http://coliru.stacked-crooked.com/a/6de5171b6d3e12ff" rel="nofollow">http://coliru.stacked-crooked.com/a/6de5171b6d3e12ff</a></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;memory&gt;
  
  using namespace std;
  
  template &lt; typename D &gt;
  class Base
  {
  public:
      typedef D EType;
  };
  
  template&lt;class T&gt;
  struct is_Base
  {
      using base_type = typename std::remove_cv&lt;typename std::remove_reference&lt;T&gt;::type&gt;::type;
  
      template&lt;class U&gt;
      static constexpr std::true_type test(Base&lt;U&gt; *) { return std::true_type(); }
      static constexpr std::false_type test(...) { return std::false_type(); }
  
      using value = decltype( test((T*)0) );
  };
  
  template &lt; typename A &gt;
  using static_passoff = std::integral_constant&lt; bool, A::value &gt;;
  
  template &lt;typename T, typename = typename std::enable_if&lt; static_passoff&lt; typename is_Base&lt; T &gt;::value &gt;::value &gt;::type &gt;
  void foo(T const&amp;)
  {
  }
  
  
  class Derived : public Base&lt;Derived&gt; {};
  class NotDerived {};
  
  
  int main()
  {
      Derived d;
      //NotDerived nd;
  
      foo(d);
      //foo(nd); // &lt;-- Should cause compile error
  
      return 0;
  }
  </code></pre>