メンバへのポインタのtypeid
#include <iostream> #include <typeinfo> struct tmp { int i; int j; }; int main() { int tmp::*ptr; // the pointer to a member of class tmp ptr = &tmp::j; // Note that tmp instance is not spawned std::cout << typeid(ptr).name() << std::endl; tmp foo; std::cout << typeid(foo.*ptr).name() << std::endl; std::cout << typeid(int*).name() << std::endl; return 0; }
g++ 4.5での実行結果
M3tmpi i Pi
3っていうのは後ろに続くクラス名の文字数らしい。
適当にクラス名を変更して確認してみた。
Mはメンバへのポインタって意味なのかな?