title: Can I cast an array of POD which has floats to float*?
body: <p>Consider the following:</p>
  
  <pre><code>#include &lt;vector&gt;
  using namespace std;
  
  struct Vec2
  {
    float m_x;
    float m_y;
  };
  
  vector&lt;Vec2&gt; myArray;
  
  int main()
  {
    myArray.resize(100);
  
    for (int i = 0; i &lt; 100; ++i)
    {
      myArray[i].m_x = (float)(i);
      myArray[i].m_y = (float)(i);
    }
  
    float* raw;
    raw = reinterpret_cast&lt;float*&gt;(&amp;(myArray[0]));
  }
  </code></pre>
  
  <p>Is <code>raw</code> guaranteed to have 200 contiguous floats with the correct values? That is, does the standard guarantee this? </p>
  
  <p><strong>EDIT</strong>: If the above is guaranteed, and if <code>Vec2</code> has some functions (non-virtual) and a constructor, is the guarantee still there?</p>
  
  <blockquote>
    <p><strong>NOTE:</strong> I realize this is dangerous, in my particular case I have no
    choice as I am working with a 3rd party library.</p>
  </blockquote>