> 
> **Possible Duplicate:**  
> 
> [Determine if Type is a pointer in a template function](https://stackoverflow.com/questions/301330/determine-if-type-is-a-pointer-in-a-template-function)  
> 
> 
> 

I am looking for a method to determine whether a template is a pointer or not at compiling time. Because when T is not a pointer, the program will not compile as you cannot delete a normal type variable.

```
template <typename T>
void delete(T &aVar)
{
   // if T is a point
   delete aVar;
   aVar = 0;
   // if T is not a point, do nothing
}

```

---

Basically, I am learning to create a link list(not using the STL list) myself. And I tried to use template in my list so it can take any types. When the type is a pointer, I want to delete it (the keyword delete) automatically by the destructor.

The problem is, as writen above, when I use int rather than some pointer of a class in the list, VC2010 wont compile because you cannot delete an none pointer variable. So I am looking for a method, such as macro to deceide when delete aVar should be compiled or not according to the template type