class complex<float> {
public:
complex(float re = 0, float im = 0);
explicit complex(const complex<double>& x);
explicit complex(const complex<long double>& x);
// rest same as template class complex
};
The explicitly specialized template class describes an object that stores two objects of type float
, one that represents
the real part of a complex number and one that represents the imaginary part. The explicit specialization differs only in
the constructors it defines. The first constructor initializes the stored real part to re
and the stored imaginary part to im
.
The remaining two constructors initialize the stored real part to x.real()
and the stored imaginary part to x.imag()
.