Namespaces
Variants

std::type_index:: name

From cppreference.net
Utilities library
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であることが要求されていなかった 要求される