I've stored a pointer to a type_info
object.
int MyVariable = 123;
const std::type_info* Datatype = &typeid(MyVariable);
How might I use this to typecast another variable to that type? I tried this, but it doesn't work:
std::cout << ((*Datatype)3.14) << std::endl;
Using the function form of typecasting doesn't work, either:
std::cout << (*Datatype(3.14)) << std::endl;