std::type_index:: name
From cppreference.net
<
cpp
|
types
|
type index
C++
Utilities library
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Type support
| Basic types | |||||||||||||||||||||
| Fixed width integer types (C++11) | |||||||||||||||||||||
| Fixed width floating-point types (C++23) | |||||||||||||||||||||
|
|||||||||||||||||||||
| Numeric limits | |||||||||||||||||||||
| C numeric limits interface | |||||||||||||||||||||
| Runtime type information | |||||||||||||||||||||
|
|||||||||||||||||||||
std::type_index
| Member functions | ||||
|
type_index::name
|
||||
| Helper classes | ||||
|
(C++11)
|
|
const
char
*
name
(
)
const
noexcept
;
|
(C++11以降) | |
関連付けられた std::type_info オブジェクトの名前を返します。 std::type_info::name() を直接呼び出すのと同等です。
目次 |
パラメータ
(なし)
戻り値
関連付けられた std::type_info オブジェクトの名前。
例
このコードを実行
#include <iostream> #include <typeindex> int main() { std::cout << std::type_index(typeid(std::cout)).name(); }
出力例:
NSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
欠陥報告
以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | 適用対象 | 公開時の動作 | 正しい動作 |
|---|---|---|---|
| LWG 2144 | C++11 |
type_index::name
noexceptであることが要求されていなかった
|
要求される |