title: void* to vector
body: <p>I have a function from some big library. I must pass the argument as void*. I want to pass a vector. I'm passing it using</p>
  
  <pre><code>vector&lt;myClass*&gt; myName;
  
  function(...,(void*)&amp;myName,...)
  </code></pre>
  
  <p>Now in this function I want to cast void* back to vector but I don't know how to do this.</p>
  
  <p>I'm trying something like:</p>
  
  <pre><code>vector&lt;myClass*&gt; myName = static_cast&lt; vector&lt;myClass*&gt; &gt;(voidPointerName);
  </code></pre>
  
  <p>but I get</p>
  
  <pre><code>error: invalid conversion from ‘void*’ to ‘long unsigned int’
  
  error:   initializing argument 1 of ‘std::vector&lt;_Tp, _Alloc&gt;
              ::vector(size_t, const _Tp&amp;, const _Alloc&amp;)
              [with _Tp = myClass*, _Alloc = std::allocator&lt;myClass*&gt;]’
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>What I want to do is pass a vector of pointers to my own class to this function <a href="http://ftp.heanet.ie/disk1/www.gnu.org/software/libmicrohttpd/microhttpd/microhttpd_10.html" rel="nofollow">http://ftp.heanet.ie/disk1/www.gnu.org/software/libmicrohttpd/microhttpd/microhttpd_10.html</a>, so I must cast it to void* and then cast it back to vector, so the code looks like:</p>
  
  <pre><code>    vector&lt;myClass*&gt; v
      MHD_create_response_from_callback (...,HERE_PASS_VECTOR,...);
  </code></pre>
  
  <p>and code for this function:</p>
  
  <pre><code>    callback(void* cls,...)
      {
        CAST_CLS_BACK_TO_VECTOR
        ITERATE_OVER_VECTOR
      }
  </code></pre>