title: find out the class type inside the class and its children
body: <p>Lets say I have the class </p>
  
  <pre><code>template&lt;typename PointT&gt;
  class Parent {
    public:
    typedef boost::shared_ptr&lt;Parent&lt;PointT&gt; &gt; Ptr;
  
    inline Ptr
    makeShared ()
    {
      return Ptr (new Parent&lt;PointT&gt; (*this));
    }
  };
  
  template&lt;typename PointT&gt;
  class Child : public Parent {
    public:
      typedef boost::shared_ptr&lt;Child&lt;PointT&gt; &gt; Ptr;
  };
  </code></pre>
  
  <p>Now what I'd like to rewrite the definition of Ptr and makeShared() to be generic, so that calling makeShared() from child class(es) instances would yield a pointer to the child class not the parent</p>
  
  <p>To make it more clear calling makeShared() on any class inheriting Parent would give a pointer to an instance of that inheriting class. and calling make shared() on the parent class would give a pointer to an instance of Parent class 
  Any ideas?</p>