On this page
std::complex<T>::complex
|
||
| (1) | ||
|
(until C++14) | |
|
(since C++14) | |
| (2) | ||
|
(until C++14) | |
|
(since C++14) (until C++23) |
|
|
(since C++23) | |
| (3) | ||
|
(until C++14) | |
|
(since C++14) (until C++23) |
|
|
(since C++23) | |
|
||
| (1) | ||
|
(until C++11) | |
|
(since C++11) | |
|
(2) | (since C++20) |
| (3) | ||
|
(until C++11) | |
|
(since C++11) | |
|
||
| (1) | ||
|
(until C++11) | |
|
(since C++11) | |
|
(2) | (since C++20) |
| (3) | ||
|
(until C++11) | |
|
(since C++11) | |
|
||
| (1) | ||
|
(until C++11) | |
|
(since C++11) | |
|
(2) | (since C++20) |
| (3) | ||
|
(until C++11) | |
|
(since C++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 C++23)
re and imaginary part im.
other. The copy constructors are implicitly declared in the standard explicit specializations.(until C++20)
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 inside explicit evaluates to false if and only if the floating-point conversion rank of |
(since C++23) |
Parameters
| re | - | the real part |
| im | - | the imaginary part |
| other | - | another complex number to use as source |
Notes
Since C++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) |
|
|
(C++14)
|
a std::complex literal representing purely imaginary number (function) |
C documentation for CMPLX |
|
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/numeric/complex/complex