標準庫標頭檔案 <complex>
來自 cppreference.com
此標頭檔案是 numeric 庫的一部分。
目錄 |
[編輯] 類
複數型別 (類模板) |
[編輯] 函式
操作 | |
對複數應用一元運算子 (函式模板) | |
對兩個複數值或一個複數和一個標量執行復數算術 (函式模板) | |
(在 C++20 中移除) |
比較兩個複數或一個複數和一個標量 (函式模板) |
序列化和反序列化複數 (函式模板) | |
返回實部 (函式模板) | |
返回虛部 (函式模板) | |
返回複數的模 (函式模板) | |
返回相角 (函式模板) | |
返回模的平方 (函式模板) | |
返回複共軛 (函式模板) | |
(C++11) |
返回到黎曼球面上的投影 (函式模板) |
從模和相角構造一個複數 (函式模板) | |
指數函式 | |
複數 e 的指數 (函式模板) | |
具有沿負實軸分支割線的複數自然對數 (函式模板) | |
具有沿負實軸分支割線的複數常用對數 (函式模板) | |
冪函式 | |
複數冪,一個或兩個引數可以是複數 (函式模板) | |
右半平面範圍內的復平方根 (函式模板) | |
三角函式 | |
計算複數的正弦 (sin(z)) (函式模板) | |
計算複數的餘弦 (cos(z)) (函式模板) | |
計算複數的正切 (tan(z)) (函式模板) | |
(C++11) |
計算複數的反正弦 (arcsin(z)) (函式模板) |
(C++11) |
計算複數的反餘弦 (arccos(z)) (函式模板) |
(C++11) |
計算複數的反正切 (arctan(z)) (函式模板) |
雙曲函式 | |
計算複數的雙曲正弦 (sinh(z)) (函式模板) | |
計算複數的雙曲餘弦 (cosh(z)) (函式模板) | |
計算複數的雙曲正切 (tanh(z)) (函式模板) | |
(C++11) |
計算複數的反雙曲正弦 (arsinh(z)) (函式模板) |
(C++11) |
計算複數的反雙曲餘弦 (arcosh(z)) (函式模板) |
(C++11) |
計算複數的反雙曲正切 (artanh(z)) (函式模板) |
字面量 | |
表示純虛數的 std::complex 字面量 (函式) |
[編輯] 概要
namespace std { template<class T> class complex; template<> class complex<float>; template<> class complex<double>; template<> class complex<long double>; // operators: template<class T> constexpr complex<T> operator+( const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator+(const complex<T>&, const T&); template<class T> constexpr complex<T> operator+(const T&, const complex<T>&); template<class T> constexpr complex<T> operator-( const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator-(const complex<T>&, const T&); template<class T> constexpr complex<T> operator-(const T&, const complex<T>&); template<class T> constexpr complex<T> operator*( const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator*(const complex<T>&, const T&); template<class T> constexpr complex<T> operator*(const T&, const complex<T>&); template<class T> constexpr complex<T> operator/( const complex<T>&, const complex<T>&); template<class T> constexpr complex<T> operator/(const complex<T>&, const T&); template<class T> constexpr complex<T> operator/(const T&, const complex<T>&); template<class T> constexpr complex<T> operator+(const complex<T>&); template<class T> constexpr complex<T> operator-(const complex<T>&); template<class T> constexpr bool operator==(const complex<T>&, const complex<T>&); template<class T> constexpr bool operator==(const complex<T>&, const T&); template<class T> constexpr bool operator==(const T&, const complex<T>&); template<class T> constexpr bool operator!=(const complex<T>&, const complex<T>&); template<class T> constexpr bool operator!=(const complex<T>&, const T&); template<class T> constexpr bool operator!=(const T&, const complex<T>&); template<class T, class CharT, class Traits> basic_istream<CharT, Traits>& operator>>(basic_istream<CharT, Traits>&, complex<T>&); template<class T, class CharT, class Traits> basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>&, const complex<T>&); // values: template<class T> constexpr T real(const complex<T>&); template<class T> constexpr T imag(const complex<T>&); template<class T> T abs(const complex<T>&); template<class T> T arg(const complex<T>&); template<class T> constexpr T norm(const complex<T>&); template<class T> constexpr complex<T> conj(const complex<T>&); template<class T> complex<T> proj(const complex<T>&); template<class T> complex<T> polar(const T&, const T& = 0); // transcendentals: template<class T> complex<T> acos(const complex<T>&); template<class T> complex<T> asin(const complex<T>&); template<class T> complex<T> atan(const complex<T>&); template<class T> complex<T> acosh(const complex<T>&); template<class T> complex<T> asinh(const complex<T>&); template<class T> complex<T> atanh(const complex<T>&); template<class T> complex<T> cos (const complex<T>&); template<class T> complex<T> cosh (const complex<T>&); template<class T> complex<T> exp (const complex<T>&); template<class T> complex<T> log (const complex<T>&); template<class T> complex<T> log10(const complex<T>&); template<class T> complex<T> pow(const complex<T>&, const T&); template<class T> complex<T> pow(const complex<T>&, const complex<T>&); template<class T> complex<T> pow(const T&, const complex<T>&); template<class T> complex<T> sin (const complex<T>&); template<class T> complex<T> sinh(const complex<T>&); template<class T> complex<T> sqrt(const complex<T>&); template<class T> complex<T> tan (const complex<T>&); template<class T> complex<T> tanh(const complex<T>&); // tuple interface: template<class T> struct tuple_size; template<size_t I, class T> struct tuple_element; template<class T> struct tuple_size<complex<T>>; template<size_t I, class T> struct tuple_element<I, complex<T>>; template<size_t I, class T> constexpr T& get(complex<T>&) noexcept; template<size_t I, class T> constexpr T&& get(complex<T>&&) noexcept; template<size_t I, class T> constexpr const T& get(const complex<T>&) noexcept; template<size_t I, class T> constexpr const T&& get(const complex<T>&&) noexcept; // complex literals: inline namespace literals { inline namespace complex_literals { constexpr complex<long double> operator""il(long double); constexpr complex<long double> operator""il(unsigned long long); constexpr complex<double> operator""i(long double); constexpr complex<double> operator""i(unsigned long long); constexpr complex<float> operator""if(long double); constexpr complex<float> operator""if(unsigned long long); } } }
[編輯] 類 std::complex
template<class T> class complex { public: typedef T value_type; constexpr complex(const T& re = T(), const T& im = T()); constexpr complex(const complex&) = default; template<class X> constexpr explicit(/* see constructor page */) complex(const complex<X>&); constexpr T real() const; constexpr void real(T); constexpr T imag() const; constexpr void imag(T); constexpr complex<T>& operator= (const T&); constexpr complex<T>& operator+=(const T&); constexpr complex<T>& operator-=(const T&); constexpr complex<T>& operator*=(const T&); constexpr complex<T>& operator/=(const T&); constexpr complex& operator=(const complex&); template<class X> constexpr complex<T>& operator= (const complex<X>&); template<class X> constexpr complex<T>& operator+=(const complex<X>&); template<class X> constexpr complex<T>& operator-=(const complex<X>&); template<class X> constexpr complex<T>& operator*=(const complex<X>&); template<class X> constexpr complex<T>& operator/=(const complex<X>&); };
[編輯] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
---|---|---|---|
LWG 79 | C++98 | 第二個形參的預設實參 在 polar 的概要中缺失 |
已新增 |