title: How can I convert a vector<uint8_t> into an unsigned char*
body: <p>I have a <code>const vector&lt;uint8_t&gt;&gt;</code>, and I need to pass it to a function that takes a <code>const unsigned char*</code>. The two types are the same size, etc., so I'm guessing that there is an good way to coerce the types here. What's the idiomatic way of handling this type of problem? </p>
  
  <p>My first instinct is to use <a href="http://msdn.microsoft.com/en-us/library/e0w9f63b.aspx" rel="nofollow">reinterpret_cast</a>, but after the cast the data isn't the same. Here is my code:</p>
  
  <pre><code>shared_ptr&lt;const vector&lt;uint8_t&gt;&gt; data = operation.getData();
  const unsigned char* data2 = reinterpret_cast&lt;const unsigned char*&gt;(&amp;data);
  myFunction(data2, data-&gt;size());
  </code></pre>
  
  <p>Chances are I've confused a pointer for a value here, but maybe my entire approach is incorrect. </p>