タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

typeidに関するzyxwvのブックマーク (1)

  • C++のtypeidとtype_infoとtype_index

    10月の論文集が発表されるまで暇なので、typeidとtype_infoと、C++11から追加されたtype_indexの解説をする。 C++でRTTI(Run Time Type Infomation/Identification)と呼ばれる機能がある。 std::type_infoは、型情報を表現するクラスである。type_infoのオブジェクトは、typeid式で得ることができる。typeid式は、オペランドに式かtype-idを取る。typeid式の結果は、constなstd::type_info型のlvalueである。typeid式を使うには、typeinfoヘッダーをincludeする必要がある。 #include <typeinfo> std::type_info const & t1 = typeid(int) ; std::type_info const & t2 = t

  • 1