65 typedef _Tp value_type;
70 complex() : _M_real(_Tp()), _M_imag(_Tp()) {}
73 complex(
const _Tp &__r,
const _Tp &__i = _Tp(0))
74 : _M_real(__r), _M_imag(__i) {}
77 template <
typename _Up>
80#if __cplusplus >= 201103L
81 const _Tp &real()
const {
return _M_real; }
82 const _Tp &imag()
const {
return _M_imag; }
84 _Tp &real() {
return _M_real; }
85 const _Tp &real()
const {
return _M_real; }
86 _Tp &imag() {
return _M_imag; }
87 const _Tp &imag()
const {
return _M_imag; }
90 void real(_Tp __val) { _M_real = __val; }
92 void imag(_Tp __val) { _M_imag = __val; }
133 template <
typename _Up>
135 _M_real = __z.real();
136 _M_imag = __z.imag();
142 template <
typename _Up>
144 _M_real += __z.real();
145 _M_imag += __z.imag();
151 template <
typename _Up>
153 _M_real -= __z.real();
154 _M_imag -= __z.imag();
160 template <
typename _Up>
162 const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
163 _M_imag = _M_real * __z.imag() + _M_imag * __z.real();
170 template <
typename _Up>
175 _M_real = a.real() / b.real();
176 _M_imag = a.imag() / b.real();