title: C++ casting void pointer to template class
body: <pre><code>template &lt;typename Type&gt; struct testClass{
      Type value;
  };
  
  int main(){
      void* ptr = new testClass&lt;int&gt;;
      ptr-&gt;value = 0;
  
      return 0;
  }
  </code></pre>
  
  <p>This doesn't work because the void pointer doesn't know what type it's pointing to, so I would have to cast it into the correct data type. I'm not sure how to do this for a template class however.</p>
  
  <p>I tried:</p>
  
  <pre><code>(ptr&lt;testClass&gt;)-&gt;value = 0;
  </code></pre>
  
  <p>But the error says it's missing template arguments before '>'. I'm not sure how to cast it to testClass(int)</p>