title: C++ member variable aliases?
body: <p>I'm pretty sure this is possible, because I'm pretty sure I've seen it done. I think it is awesome, but I will gladly accept answers along the lines of "this is a terrible idea because ____".</p>
  
  <p>Say we have a basic struct.</p>
  
  <pre><code>struct vertex
  {
      float x, y, z;
  };
  </code></pre>
  
  <p>Now, I want to implement aliases on these variables.</p>
  
  <pre><code>vertex pos;
  vertex col;
  vertex arr;
  
  pos.x = 0.0f; pos.y = 0.5f; pos.z = 1.0f;
  col.r = 0.0f; col.g = 0.5f; col.b = 1.0f;
  arr[0] = 0.0f; arr[1] = 0.5f; arr[2] = 1.0f;
  </code></pre>
  
  <p>Ideally the third syntax would be indistinguishable from an array. That is, if I sent <code>arr</code> as a reference parameter to a function expecting an array of floats into which it will store data (eg many of the OpenGL <code>glGet</code> functions), it would work fine.</p>
  
  <p>What do you think? Possible? Possible but stupid?</p>