title: Is there a way to compile-time assert if a variable is a class, struct or a basic type in c++?
body: <p>I am trying to implement a template class that would be able to tell me if a variable is a class,structure or a basic type.</p>
  
  <p>So far I've come with this:</p>
  
  <pre><code>template&lt; typename T &gt;
  class is_class
  {
  private:
      template&lt; typename X &gt;
      static char ( &amp;i_class( void(X::*)() ) )[1];
      //
      template&lt; typename X &gt;
      static char ( &amp;i_class( X ) )[2];
  public:
      static bool const val = sizeof( i_class&lt; T &gt;(0) ) == 1;
  };
  </code></pre>
  
  <p>and ussage:</p>
  
  <pre><code>is_class&lt; int &gt;::val; // false
  is_class&lt; some_class_type &gt;::val; // true
  </code></pre>
  
  <p>The problem is that now I need to write a blank void function in every class that could be used with this code.</p>
  
  <p>Does anyone know a solution to this problem?</p>