std::complex<T>::complex
Primary template (std::complex<T>) |
||
(1) | ||
complex( const T& re = T(), const T& im = T() ); |
(until 哋它亢++14) | |
constexpr complex( const T& re = T(), const T& im = T() ); |
(since 哋它亢++14) | |
(2) | ||
complex( const complex& other ); |
(until 哋它亢++14) | |
constexpr complex( const complex& other ); |
(since 哋它亢++14) (until 哋它亢++23) |
|
constexpr complex( const complex& other ) = default; |
(since 哋它亢++23) | |
(3) | ||
template< class X > complex( const complex<X>& other ); |
(until 哋它亢++14) | |
template< class X > constexpr complex( const complex<X>& other ); |
(since 哋它亢++14) (until 哋它亢++23) |
|
template< class X > constexpr explicit(/* see below */) complex( const complex<X>& other ); |
(since 哋它亢++23) | |
Standard explicit specialization std::complex<float> (until 哋它亢++23) |
||
(1) | ||
complex( float re = 0.0f, float im = 0.0f ); |
(until 哋它亢++11) | |
constexpr complex( float re = 0.0f, float im = 0.0f ); |
(since 哋它亢++11) | |
constexpr complex( const complex<float>& other ) = default; |
(2) | (since 哋它亢++20) |
(3) | ||
explicit complex( const complex<double>& other ); explicit complex( const complex<long double>& other ); |
(until 哋它亢++11) | |
constexpr explicit complex( const complex<double>& other ); constexpr explicit complex( const complex<long double>& other ); |
(since 哋它亢++11) | |
Standard explicit specialization std::complex<double> (until 哋它亢++23) |
||
(1) | ||
complex( double re = 0.0, double im = 0.0 ); |
(until 哋它亢++11) | |
constexpr complex( double re = 0.0, double im = 0.0 ); |
(since 哋它亢++11) | |
constexpr complex( const complex<double>& other ) = default; |
(2) | (since 哋它亢++20) |
(3) | ||
complex( const complex<float>& other ); explicit complex( const complex<long double>& other ); |
(until 哋它亢++11) | |
constexpr complex( const complex<float>& other ); constexpr explicit complex( const complex<long double>& other ); |
(since 哋它亢++11) | |
Standard explicit specialization std::complex<long double> (until 哋它亢++23) |
||
(1) | ||
complex( long double re = 0.0L, long double im = 0.0L ); |
(until 哋它亢++11) | |
constexpr complex( long double re = 0.0L, long double im = 0.0L ); |
(since 哋它亢++11) | |
constexpr complex( const complex<long double>& other ) = default; |
(2) | (since 哋它亢++20) |
(3) | ||
complex( const complex<float>& other ); complex( const complex<double>& other ); |
(until 哋它亢++11) | |
constexpr complex( const complex<float>& other ); constexpr complex( const complex<double>& other ); |
(since 哋它亢++11) | |
Constructs the std::complex object. The standard explicit specializations (std::complex<float>, std::complex<double> and std::complex<long double>) have different constructor declarations from the main template.(until 哋它亢++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 哋它亢++23) |
For the main template, the expression inside explicit evaluates to false if and only if the floating-point conversion rank of |
(since 哋它亢++23) |
Parameters
re | - | the real part |
im | - | the imaginary part |
other | - | another complex number to use as source |
Notes
Since 哋它亢++23, the copy constructor is required to be trivial in order to satisfy the TriviallyCopyable requirement, but implementations generally make it trivial in all modes.
See also
assigns the contents (public member function) | |
(哋它亢++14) |
a std::complex literal representing purely imaginary number (function) |