Common mathematical functions | |||||||||||||||||||||||||||||||
Mathematical special functions(C++17) | |||||||||||||||||||||||||||||||
Mathematical constants(C++20) | |||||||||||||||||||||||||||||||
Basic linear algebra algorithms(C++26) | |||||||||||||||||||||||||||||||
Data-parallel types (SIMD)(C++26) | |||||||||||||||||||||||||||||||
Floating-point environment(C++11) | |||||||||||||||||||||||||||||||
Complex numbers | |||||||||||||||||||||||||||||||
Numeric array (valarray ) | |||||||||||||||||||||||||||||||
Pseudo-random number generation | |||||||||||||||||||||||||||||||
Bit manipulation(C++20) | |||||||||||||||||||||||||||||||
Saturation arithmetic(C++26) | |||||||||||||||||||||||||||||||
Factor operations | |||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||
Interpolations | |||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||
Generic numeric operations | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
C-style checked integer arithmetic | |||||||||||||||||||||||||||||||
|
Primary template (std::complex<T>) | ||
(1) | ||
complex(const T& re= T(),const T& im= T()); | (until C++14) | |
constexpr complex(const T& re= T(),const T& im= T()); | (since C++14) | |
(2) | ||
complex(const complex& other); | (until C++14) | |
constexpr complex(const complex& other); | (since C++14) (until C++23) | |
constexpr complex(const complex& other)=default; | (since C++23) | |
(3) | ||
template<class X> complex(const complex<X>& other); | (until C++14) | |
template<class X> constexpr complex(const complex<X>& other); | (since C++14) (until C++23) | |
template<class X> constexprexplicit(/* see below */) complex(const complex<X>& other); | (since C++23) | |
Standard explicit specializationstd::complex<float>(until C++23) | ||
(1) | ||
complex(float re=0.0f,float im=0.0f); | (until C++11) | |
constexpr complex(float re=0.0f,float im=0.0f); | (since C++11) | |
constexpr complex(const complex<float>& other)=default; | (2) | (since C++20) |
(3) | ||
explicit complex(const complex<double>& other); explicit complex(const complex<longdouble>& other); | (until C++11) | |
constexprexplicit complex(const complex<double>& other); constexprexplicit complex(const complex<longdouble>& other); | (since C++11) | |
Standard explicit specializationstd::complex<double>(until C++23) | ||
(1) | ||
complex(double re=0.0,double im=0.0); | (until C++11) | |
constexpr complex(double re=0.0,double im=0.0); | (since C++11) | |
constexpr complex(const complex<double>& other)=default; | (2) | (since C++20) |
(3) | ||
complex(const complex<float>& other); explicit complex(const complex<longdouble>& other); | (until C++11) | |
constexpr complex(const complex<float>& other); constexprexplicit complex(const complex<longdouble>& other); | (since C++11) | |
Standard explicit specializationstd::complex<longdouble>(until C++23) | ||
(1) | ||
complex(longdouble re= 0.0L,longdouble im= 0.0L); | (until C++11) | |
constexpr complex(longdouble re= 0.0L,longdouble im= 0.0L); | (since C++11) | |
constexpr complex(const complex<longdouble>& other)=default; | (2) | (since C++20) |
(3) | ||
complex(const complex<float>& other); complex(const complex<double>& other); | (until C++11) | |
constexpr complex(const complex<float>& other); constexpr complex(const complex<double>& other); | (since C++11) | |
Constructs thestd::complex object. The standard explicit specializations (std::complex<float>,std::complex<double> andstd::complex<longdouble>) have different constructor declarations from the main template.(until C++23)
The main template provides a converting constructor template, while each standard explicit specialization provides two non-template constructors for the two other standard explicit specializations. The non-template constructors are converting constructors (i.e. non-explicit) if and only if the conversions of the real and imaginary parts are not narrowing. | (until C++23) |
For the main template, the expression insideexplicit evaluates tofalse if and only if thefloating-point conversion rank of | (since C++23) |
re | - | the real part |
im | - | the imaginary part |
other | - | another complex number to use as source |
Since C++23, the copy constructor is required to betrivial in order to satisfy theTriviallyCopyable requirement, but implementations generally make it trivial in all modes.
assigns the contents (public member function)[edit] | |
astd::complex literal representing purely imaginary number (function)[edit] | |
C documentation forCMPLX |