Retrieving size of datatype from std::type_info
问题 In C++03, when you use the operator typeid, a type_info object is returned. Is it possible to retrieve the size of the given type based only on this result, such as returned by the sizeof operator? For example: std::type_info info = typeid(int); int intSize = sizeof(int); int intSize2 = info.getSize(); // doesn't exist! The issue is that we use a third-party multi array class that gives back a type_info, but not the size of the type. 回答1: The best way I can see (I would like to be proven