title: How to store type information, gathered from a constructor, at the class level to use in casting
body: <p>I am trying to write a class that I can store and use type information in without the need for a template parameter.</p>
  
  <p>I want to write something like this:</p>
  
  <pre><code>class Example
  {
  public:
      template&lt;typename T&gt;
      Example(T* ptr)
          : ptr(ptr)
      {
          // typedef T EnclosedType; I want this be a avaialable at the class level.
      }
  
      void operator()()
      {
          if(ptr == NULL)
              return;
  
          (*(EnclosedType*)ptr)(); // so i can cast the pointer and call the () operator if the class has one.
      }
  
  private:
      void* ptr;
  }
  </code></pre>
  
  <p>I am not asking how to write an is_functor() class.</p>
  
  <p>I want to know how to get type information in a constructor and store it at the class level. If that is impossible, a different solution to this would be appreciated.</p>