title: Check at compile time if type is pointer
body: <p>I"m trying to find a way to tell if a type is a pointer at compile time. That is something like this:</p>
  
  <pre><code>#include &lt;type_traits&gt;
  #if std::is_pointer&lt;char*&gt;::value
  #pragma message("blah")
  #endif
  </code></pre>
  
  <p>However, this gives "warning C4067: unexpected tokens following preprocessor directive - expected a newline" twice (I think the :: is what confuses it) and it doesn't print blah. When I hoover over ::value the compiler tells me if it's true, which means it's known at compile time so this should work.</p>
  
  <p>The reason for this is that I want to be able to do something like this:</p>
  
  <pre><code>T pHead;
  #if std::is_pointer&lt;T&gt;::value
  pHead= NULL;
  #endif
  </code></pre>
  
  <p>where I NULL the variable if it's a pointer. It has to be a compile time check because if T is a struct I cannot assign NULL to its variable. I.e. the following code won't compile when T is a struct:</p>
  
  <pre><code>T pHead;
  if (std::is_pointer&lt;T&gt;::value)
      pHead= NULL;
  </code></pre>
  
  <p>Thanks<br>
  Matt</p>