title: std::complex<float> with error C2106: '=': left operand must be l-value
body: <p>I performed fast Fourier transform (fft) on my <code>signal</code>, turning it into <code>signalComplex</code>; <code>signal</code> is a series of real float numbers and <code>signalComplex</code> represents a series of complex numbers:</p>
  <pre><code>std::vector&lt;std::complex&lt;float&gt;&gt; signalComplex(numSamplesPerScan);   // int numSamplesPerScan
  
      fft.fwd(signalComplex, signal);    //  std::vector&lt;float&gt; signal
  
      for (int n = 1; n &lt; numSamplesPerScan / 2; n++)   // simplified procedure to calculate HT
      {
          float real = signalComplex[n].real();   // positive frequency X 2
          float imag = signalComplex[n].imag();
  
          real *= 2;
          imag *= 2;
  
          signalComplex[n].real() = real;  // compiler complains here
          signalComplex[n].imag() = imag;  // compiler complains here
  
          signalComplex[n + numSamplesPerScan / 2].real() = 0;    // compiler complains here
          signalComplex[n + numSamplesPerScan / 2].imag() = 0;    // compiler complains here
      }
  </code></pre>
  <p>In the for loop above, I am trying to do some simple computation on real and imaginary parts of the <code>signalComplex</code>. However, the compiler complains about &quot;<strong>error C2106: '=': left operand must be l-value</strong>&quot;; I am not sure how to do computation on the real imaginary parts in this case.</p>
  <p>Any pointer is appreciated. Some code is highly appreciated.</p>