title: How do I get the value of this void* back?
body: <p>I have a void pointer of which I can set the value just fine (at least I think I did it right). But when I try to get the value of what is stored there, all I get nothing back. Doesn't matter if the void* points to a string or int or anything else.
  What am I missing here?</p>
  
  <pre><code>class Vertex2{
  public:
      int _id;
  
      void *_data;
  
      template&lt;typename T&gt;
      T getData() {
          T *value = (T*)_data;
          return *value;
      }
  
      template &lt;typename T&gt;
      void setData(T data) {
          _data  = &amp;data;
      }
  };
  </code></pre>