Z
zender
Hi,
Is it possible to a value separately to the real or imaginary
part of a complex number?
Any help appreciated,
Charlie
The following code shows that .real() and .imag() are not lvalues:
#include <iostream>
#include <complex>
int main()
{
std::complex<double> scalar;
scalar.real()=0.0;
}
zender@ashes:~/c++$ g++ -Wall -g -I${HOME}/include -o tst tst.cc
tst.cc: In function `int main()':
tst.cc:17: error: non-lvalue in assignment
Is it possible to a value separately to the real or imaginary
part of a complex number?
Any help appreciated,
Charlie
The following code shows that .real() and .imag() are not lvalues:
#include <iostream>
#include <complex>
int main()
{
std::complex<double> scalar;
scalar.real()=0.0;
}
zender@ashes:~/c++$ g++ -Wall -g -I${HOME}/include -o tst tst.cc
tst.cc: In function `int main()':
tst.cc:17: error: non-lvalue in assignment