📄 complex.html
字号:
<PRE><B>complex</B>(const complex& right);</PRE><P>which is the copy constructor.</P><H3><A NAME="complex::imag"><CODE>complex::imag</CODE></A></H3><PRE>Ty <B>imag</B>() const;</PRE><P>The member function returns the stored imaginary part.</P><H3><A NAME="complex::operator*="><CODE>complex::operator*=</CODE></A></H3><PRE>template<class Other> complex& <B>operator*=</B>(const complex<Other>& right);complex& <B>operator*=</B>(const Ty& right);</PRE><P>The first member function replaces the stored real and imaginary partswith those corresponding to the complex product of <CODE>*this</CODE>and <CODE>right</CODE>. It then returns <CODE>*this</CODE>.</P><P>The second member function multiplies both the stored real partand the stored imaginary part with <CODE>right</CODE>.It then returns <CODE>*this</CODE>.</P><P>In this<A HREF="index.html#implementation">implementation</A>, if atranslator does not support member template functions, the template:</P><PRE>template<class Other> complex& <B>operator*=</B>(const complex<Other>& right);</PRE><P>is replaced by:</P><PRE>complex& <B>operator*=</B>(const complex& right);</PRE><H3><A NAME="complex::operator+="><CODE>complex::operator+=</CODE></A></H3><PRE>template<class Other> complex& <B>operator+=</B>(const complex<Other>& right);complex& <B>operator+=</B>(const Ty& right);</PRE><P>The first member function replaces the stored real and imaginary partswith those corresponding to the complex sum of <CODE>*this</CODE>and <CODE>right</CODE>. It then returns <CODE>*this</CODE>.</P><P>The second member function adds <CODE>right</CODE> to the stored real part.It then returns <CODE>*this</CODE>.</P><P>In this<A HREF="index.html#implementation">implementation</A>, if atranslator does not support member template functions, the template:</P><PRE>template<class Other> complex& <B>operator+=</B>(const complex<Other>& right);</PRE><P>is replaced by:</P><PRE>complex& <B>operator+=</B>(const complex& right);</PRE><H3><A NAME="complex::operator-="><CODE>complex::operator-=</CODE></A></H3><PRE>template<class Other> complex& <B>operator-=</B>(const complex<Other>& right);complex& <B>operator-=</B>(const Ty& right);</PRE><P>The first member function replaces the stored real and imaginary partswith those corresponding to the complex difference of <CODE>*this</CODE>and <CODE>right</CODE>. It then returns <CODE>*this</CODE>.</P><P>The second member function subtracts <CODE>right</CODE> fromthe stored real part. It then returns <CODE>*this</CODE>.</P><P>In this<A HREF="index.html#implementation">implementation</A>, if atranslator does not support member template functions, the template:</P><PRE>template<class Other> complex& <B>operator-=</B>(const complex<Other>& right);</PRE><P>is replaced by:</P><PRE>complex& <B>operator-=</B>(const complex& right);</PRE><H3><A NAME="complex::operator/="><CODE>complex::operator/=</CODE></A></H3><PRE>template<class Other> complex& <B>operator/=</B>(const complex<Other>& right);complex& <B>operator/=</B>(const Ty& right);</PRE><P>The first member function replaces the stored real and imaginary partswith those corresponding to the complex quotient of <CODE>*this</CODE>and <CODE>right</CODE>. It then returns <CODE>*this</CODE>.</P><P>The second member function multiplies both the stored real partand the stored imaginary part with <CODE>right</CODE>.It then returns <CODE>*this</CODE>.</P><P>In this<A HREF="index.html#implementation">implementation</A>, if atranslator does not support member template functions, the template:</P><PRE>template<class Other> complex& <B>operator/=</B>(const complex<Other>& right);</PRE><P>is replaced by:</P><PRE>complex& <B>operator/=</B>(const complex& right);</PRE><H3><A NAME="complex::operator="><CODE>complex::operator=</CODE></A></H3><PRE>template<class Other> complex& <B>operator=</B>(const complex<Other>& right);complex& <B>operator=</B>(const Ty& right);</PRE><P>The first member function replaces the stored real part with<CODE>right.real()</CODE> and the stored imaginary partwith <CODE>right.imag()</CODE>. It then returns <CODE>*this</CODE>.</P><P>The second member function replaces the stored real part with<CODE>right</CODE> and the stored imaginary partwith zero. It then returns <CODE>*this</CODE>.</P><P>In this<A HREF="index.html#implementation">implementation</A>, if atranslator does not support member template functions, the template:</P><PRE>template<class Other> complex& <B>operator=</B>(const complex<Other>& right);</PRE><P>is replaced by:</P><PRE>complex& <B>operator=</B>(const complex& right);</PRE><P>which is the default assignment operator.</P><H3><A NAME="complex::real"><CODE>complex::real</CODE></A></H3><PRE>Ty <B>real</B>() const;</PRE><P>The member function returns the stored real part.</P><H3><A NAME="complex::value_type"><CODE>complex::value_type</CODE></A></H3><PRE>typedef Ty <B>value_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Ty</CODE>.</P><H2><A NAME="complex<double>"><CODE>complex<double></CODE></A></H2><PRE>template<> class <B>complex<double></B> {public: <B>complex</B>(double realval = 0, double imagval = 0); <B>complex</B>(const complex<float>& right); explicit <B>complex</B>(const complex<long double>& right);// rest same as template class complex };</PRE><P>The explicitly specialized template classdescribes an object that stores two objectsof type <I>double,</I> one that represents the real partof a complex number and one that represents the imaginary part. Theexplicit specialization differs only in the constructors it defines.The first constructor initializes the stored real part to<CODE>realval</CODE> and the stored imaginary part to <CODE>imagval</CODE>.The remaining two constructors initialize the stored real part to<CODE>right.real()</CODE> and the stored imaginary part to<CODE>right.imag()</CODE>.</P><H2><A NAME="complex<float>"><CODE>complex<float></CODE></A></H2><PRE>template<> class <B>complex<float></B> {public: <B>complex</B>(float realval = 0, float imagval = 0); explicit <B>complex</B>(const complex<double>& right); explicit <B>complex</B>(const complex<long double>& right);// rest same as template class complex };</PRE><P>The explicitly specialized template classdescribes an object that stores two objectsof type <I>float,</I> one that represents the real partof a complex number and one that represents the imaginary part. Theexplicit specialization differs only in the constructors it defines.The first constructor initializes the stored real part to<CODE>realval</CODE> and the stored imaginary part to <CODE>imagval</CODE>.The remaining two constructors initialize the stored real part to<CODE>right.real()</CODE> and the stored imaginary part to<CODE>right.imag()</CODE>.</P><H2><A NAME="complex<long double>"><CODE>complex<long double></CODE></A></H2><PRE>template<> class <B>complex<long double></B> {public: <B>complex</B>(long double realval = 0, long double imagval = 0); <B>complex</B>(const complex<float>& right); <B>complex</B>(const complex<double>& right);// rest same as template class complex };</PRE><P>The explicitly specialized template classdescribes an object that stores two objectsof type <I>long double,</I> one that represents the real partof a complex number and one that represents the imaginary part. Theexplicit specialization differs only in the constructors it defines.The first constructor initializes the stored real part to<CODE>realval</CODE> and the stored imaginary part to <CODE>imagval</CODE>.The remaining two constructors initialize the stored real part to<CODE>right.real()</CODE> and the stored imaginary part to<CODE>right.imag()</CODE>.</P><H2><A NAME="conj"><CODE>conj</CODE></A></H2><PRE>template<class Ty> complex<Ty> <B>conj</B>(const complex<Ty>& left);</PRE><P>The function returns the conjugate of <CODE>left</CODE>.</P><H2><A NAME="cos"><CODE>cos</CODE></A></H2><PRE>template<class Ty> complex<Ty> <B>cos</B>(const complex<Ty>& left);</PRE><P>The function returns the cosine of <CODE>left</CODE>.</P><H2><A NAME="cosh"><CODE>cosh</CODE></A></H2><PRE>template<class Ty> complex<Ty> <B>cosh</B>(const complex<Ty>& left);</PRE><P>The function returns the hyperbolic cosine of <CODE>left</CODE>.</P><H2><A NAME="exp"><CODE>exp</CODE></A></H2><PRE>template<class Ty> complex<Ty> <B>exp</B>(const complex<Ty>& left);</PRE><P>The function returns the exponential of <CODE>left</CODE>.</P><H2><A NAME="imag"><CODE>imag</CODE></A></H2><PRE>template<class Ty> Ty <B>imag</B>(const complex<Ty>& left);</PRE><P>The function returns the imaginary part of <CODE>left</CODE>.</P><H2><A NAME="log"><CODE>log</CODE></A></H2><PRE>template<class Ty> complex<Ty> <B>log</B>(const complex<Ty>& left);</PRE><P>The function returns the logarithm of <CODE>left</CODE>.The branch cuts are along the negative real axis.</P><H2><A NAME="log10"><CODE>log10</CODE></A></H2>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -