关于在构造函数中使用三元赋值运算符,以下定义是否可以?
#include <cmath>
using namespace std;
class Foo{
private:
complex z; // some complex number
double arg; // the principal argument of z
public:
Foo(complex y) :
z(y),
arg(y.real() == 0.0 and y.imag() == 0.0 ? 0.0 : atan2(y.imag(), y.real())
{}
};