title: reference to a variable inside a class
body: <p>Basically I want a constant -- <strong>not a <code>const</code> reference</strong> --<br>
  reference to a variable inside a class.</p>
  
  <pre><code>class Foo
  {
  public:
      double x, y, z;
      double&amp; a = x;
      double&amp; b = y;
      double&amp; c = z;
  }
  </code></pre>
  
  <p>If I set <code>x = 3</code> I want <code>a</code> to be <code>3</code> too<br>
  so I want a to be a reference to x
  it would be easy with a pointer like <code>double* a = &amp;x;</code><br>
  but I don't want to dereference it everytime..  </p>
  
  <p>If I compile this I get this message:  </p>
  
  <pre><code>warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
  warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
  warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
  </code></pre>
  
  <p>but thats not the main problem:
  if I try now to use them (<code>a, b, c</code>) like here:</p>
  
  <pre><code>Foo foo;
  foo.x = 1.0;
  foo.y = 0.5;
  foo.z = 5.1;
  printf("a: &lt;%f&gt; b: &lt;%f&gt; c: &lt;%f&gt;\n", foo.a, foo.b, foo.c);
  </code></pre>
  
  <p>I get this compiler message:</p>
  
  <pre><code>foo.h:5 error: non-static reference member 'double&amp; Foo::a', can't use default assignment operator
  foo.h:6 error: non-static reference member 'double&amp; Foo::b', can't use default assignment operator
  foo.h:7 error: non-static reference member 'double&amp; Foo::c', can't use default assignment operator
  </code></pre>
  
  <p>foo.h:5 is <code>double&amp; a = x;</code><br>
  foo.h:6 is <code>double&amp; b = y;</code><br>
  foo.h:7 is <code>double&amp; c = z;</code></p>
  
  <p>so <strong>what</strong> is my mistake?</p>