Standard C++ Library Reference ISO/IEC (VERSION3)
The second member function replaces the stored real part with right and the stored imaginary
part with zero. It then returns *this.
In this implementation, if a translator does not support member template functions, the
template:
template<class Other>
complex& operator=(const complex<Other>& right);
is replaced by:
complex& operator=(const complex& right);
which is the default assignment operator.
complex::real
Ty real() const;
The member function returns the stored real part.
complex::value_type
typedef Ty value_type;
The type is a synonym for the template parameter Ty.
complex<double>
template<>
class complex<double> {
public:
complex(double realval = 0, double imagval = 0);
complex(const complex<float>& right);
explicit complex(const complex<long double>& right);
// 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 realval and the stored imaginary part to
imagval. The remaining two constructors initialize the stored real part to right.real()
and the stored imaginary part to right.imag().