std::complex<T>::complex
ja.cppreference.net より
| プライマリテンプレート ( std::complex<T>) |
||
complex( const T& re = T(), const T& im = T() );
|
(1) | (C++14 まで) |
constexpr complex( const T& re = T(), const T& im = T() );
|
(C++14 から) | |
complex( const complex& other );
|
(2) | (C++14 まで) |
constexpr complex( const complex& other );
|
(C++14 から) (C++23 まで) |
|
constexpr complex( const complex& other ) = default;
|
(C++23 から) | |
template< class X >
complex( const complex<X>& other );
|
(3) | (C++14 まで) |
template< class X >
constexpr complex( const complex<X>& other );
|
(C++14 から) (C++23 まで) |
|
template< class X >
constexpr explicit(/* see below */) complex( const complex<X>& other );
|
(C++23 から) | |
| 標準明示的特殊化 std::complex<float> (C++23 まで) |
||
complex( float re = 0.0f, float im = 0.0f );
|
(1) | (C++11 まで) |
constexpr complex( float re = 0.0f, float im = 0.0f );
|
(C++11 から) | |
constexpr complex( const complex<float>& other ) = default;
|
(2) | (C++20 から) |
explicit complex( const complex<double>& other );
explicit complex( const complex<long double>& other );
|
(3) | (C++11 まで) |
constexpr explicit complex( const complex<double>& other );
constexpr explicit complex( const complex<long double>& other );
|
(C++11 から) | |
| 標準明示的特殊化 std::complex<double> (C++23 まで) |
||
complex( double re = 0.0, double im = 0.0 );
|
(1) | (C++11 まで) |
constexpr complex( double re = 0.0, double im = 0.0 );
|
(C++11 から) | |
constexpr complex( const complex<double>& other ) = default;
|
(2) | (C++20 から) |
complex( const complex<float>& other );
explicit complex( const complex<long double>& other );
|
(3) | (C++11 まで) |
constexpr complex( const complex<float>& other );
constexpr explicit complex( const complex<long double>& other );
|
(C++11 から) | |
| 標準明示的特殊化 std::complex<long double> (C++23 まで) |
||
complex( long double re = 0.0L, long double im = 0.0L );
|
(1) | (C++11 まで) |
constexpr complex( long double re = 0.0L, long double im = 0.0L );
|
(C++11 から) | |
constexpr complex( const complex<long double>& other ) = default;
|
(2) | (C++20 から) |
complex( const complex<float>& other );
complex( const complex<double>& other );
|
(3) | (C++11 まで) |
constexpr complex( const complex<float>& other );
constexpr complex( const complex<double>& other );
|
(C++11 から) | |
以下の std::complex オブジェクトを構築する。 標準明示的特殊化 (std::complex<float>, std::complex<double> と std::complex<long double>) はプライマリテンプレートとは異なるコンストラクタ宣言を持ちます。(C++23 まで)
1) 実部
re と虚部 im から複素数を構築します。2) コピーコンストラクタ。
other の内容のコピーでオブジェクトを構築します。コピーコンストラクタは標準明示的特殊化において暗黙に宣言されます。(C++20 まで)3) 変換コンストラクタ。異なる型の複素数からオブジェクトを構築します。
|
プライマリテンプレートは変換コンストラクタテンプレートを提供しますが、各標準明示的特殊化は他の2つの標準明示的特殊化に対して2つの非テンプレートコンストラクタを提供します。 非テンプレートコンストラクタは、実部と虚部の変換が縮小変換でない場合に限り、変換コンストラクタ(つまり explicit でない)となります。 |
(C++23 まで) |
|
プライマリテンプレートについて、 |
(C++23 から) |
パラメータ
| re | - | 実数部 |
| im | - | 虚数部 |
| other | - | ソースとして使用する別の複素数 |
注記
C++23以降、コピーコンストラクタは trivial であることが要求されるようになりました( TriviallyCopyable 要件を満たすため)。ただし、実装では一般的に全てのモードでtrivialとなるようにされています。
関連項目
|
内容を代入する
(公開メンバ関数) |
|
|
純虚数を表す
std::complex
リテラル
(関数) |
|
|
Cドキュメント
を参照
|
|