std::complex<T>:: real
From cppreference.net
|
プライマリテンプレート
std::
complex
<
T
>
|
||
| (1) | ||
|
T real
(
)
const
;
|
(C++14まで) | |
|
constexpr
T real
(
)
const
;
|
(C++14以降) | |
| (2) | ||
|
void
real
(
T value
)
;
|
(C++20まで) | |
|
constexpr
void
real
(
T value
)
;
|
(C++20以降) | |
|
特殊化
std::
complex
<
float
>
|
||
| (1) | ||
|
float
real
(
)
const
;
|
(C++11まで) | |
|
constexpr
float
real
(
)
const
;
|
(C++11以降) | |
| (2) | ||
|
void
real
(
float
value
)
;
|
(C++20まで) | |
|
constexpr
void
real
(
float
value
)
;
|
(C++20以降) | |
|
特殊化
std::
complex
<
double
>
|
||
| (1) | ||
|
double
real
(
)
const
;
|
(C++11まで) | |
|
constexpr
double
real
(
)
const
;
|
(C++11以降) | |
| (2) | ||
|
void
real
(
double
value
)
;
|
(C++20まで) | |
|
constexpr
void
real
(
double
value
)
;
|
(C++20以降) | |
|
特殊化
std::
complex
<
long
double
>
|
||
| (1) | ||
|
long
double
real
(
)
const
;
|
(C++11まで) | |
|
constexpr
long
double
real
(
)
const
;
|
(C++11以降) | |
| (2) | ||
|
void
real
(
long
double
value
)
;
|
(C++20まで) | |
|
constexpr
void
real
(
long
double
value
)
;
|
(C++20以降) | |
複素数の実部にアクセスします。
1)
実部を返します。
2)
実数部を
value
に設定します。
目次 |
パラメータ
| value | - | 実数部に設定する値 |
戻り値
1)
*
this
の実数部。
2)
(なし)
注記
C++11では、オーバーロード (1) は std::complex の特殊化において const 修飾子なしで指定されていました。しかし、C++11では、 constexpr 指定子が非静的メンバ関数で使用されると const を暗示するため、 const が指定されているかのように振る舞います。
不具合報告
以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | 適用対象 | 公開時の動作 | 正しい動作 |
|---|---|---|---|
| LWG 387 | C++98 | 実部を直接設定できなかった |
新しい
real
オーバーロードで直接設定可能
|
関連項目
|
実部を返す
(関数テンプレート) |
|
|
複素数の虚部にアクセスする
(公開メンバ関数) |