title: Member pointer to array element
body: <p>It's possible to define a pointer to a member and using this later on:</p>
  
  <p><pre><code>struct foo
  {
    int a;
    int b[2];
  };</p>
  
  <p>int main()
  {<br>
    foo bar;
    int foo::* aptr=&amp;foo::a;
    bar.a=1;
    std::cout &lt;&lt; bar.*aptr &lt;&lt; std::endl;
  }</pre></code></p>
  
  <p>Now I need to have a pointer to a specific element of an array, so normally I'd write<br>
  <code>int foo::* bptr=&amp;(foo::b[0]);</code><br>
  However, the compiler just complains about an <code>"invalid use of non-static data member 'foo::b'</code>"
  Is it possible to do this at all (or at least without unions)?</p>
  
  <p><strong>Edit:</strong> I need a pointer to a specific element of an array, so <code>int foo::* ptr</code> points to the second element of the array (<code>foo::b[1]</code>).</p>
  
  <p><strong>Yet another edit:</strong> I need to access the element in the array by <code>bar.*ptr=2</code>, as the pointer gets used somewhere else, so it can't be called with <code>bar.*ptr[1]=2</code> or <code>*ptr=2</code>.</p>