title: Deduce a type from a void pointer
body: <p>Consider the following example:</p>
  
  <pre><code>class MyContainer {
      std::vector&lt;void *&gt; v;
  public:
      void Put(void *x) { v.push_back(x);}
      void* Get(int index) { return v[index];}
  };
  
  void Work (MyContainer&amp; c) {
      // cast_to_type(c.Get(0));
  }
  
  int main() {
      int x = 1;
      double y = 2.0;
      MyContainer c;
      c.Put(&amp;x);
      c.Put(&amp;y);
  
      Work(c);
  
      return 0;
  }
  </code></pre>
  
  <p>Assume that function <code>Work</code> knows nothing about the objects to which vector pointers point to. Also assume that inheritance is not an option and that types of the pointed objects can be arbitrary (there can be infinite number of types).</p>
  
  <p>Is it possible to deduce the type using only the void pointer returned by <code>MyContainer::Get</code> function? Can this be done using any combination of casts, templates and <code>typeid</code> operator?</p>