class complex<double> {
public:
complex(double re = 0, double im = 0);
complex(const complex<float>& 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 double
, 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()
.