title: Cast map structure to void pointer and dereference
body: <p>I have been trying to cast a map structure to a void pointer and cast it vice versa.</p>
  
  <pre><code>void addToMap(void *data){
  // add some elements to the map
  }
  
  map&lt;string, vector&lt;myStruct&gt; &gt; myMap;
  addToMap(&amp;myMap);
  </code></pre>
  
  <p>I am trying to send myMap to addToMap function as an argument and add some elements inside the function. How can I deference the void parameter back to the map structure ?</p>
  
  <p>I know that static_cast can be used to dereference the void type to know types. For instance:</p>
  
  <pre><code>int* a = new int();
  void* b = static_cast&lt;void*&gt;(a);
  int* c = static_cast&lt;int*&gt;(b);
  </code></pre>
  
  <p>The above snippet would work, but not in this case I suppose. I have already tried it out for my case, perhaps there has to be another trick.</p>