How do I typecast with type_info?

前端 未结 3 1809
暗喜
暗喜 2020-12-31 10:45

I\'ve stored a pointer to a type_info object.

int MyVariable = 123;
const std::type_info* Datatype = &typeid(MyVariable);

3条回答
  •  梦毁少年i
    2020-12-31 11:26

    Typecasting isn't a run-time process, it's a compile-time process at least for the type you're casting to. I don't think it can be done.

提交回复
热议问题