2010-11-07から1日間の記事一覧

メンバへのポインタの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 <</typeinfo></iostream>…