typeid(“”) != typeid(const char*)
问题 I'm making a C++ library which relies heavily on RTTI (customizable bridge to another language) and is very confused about string literal type. This is a simple test I made to show the problem: std::cout << typeid(const char*).name() << std::endl; // PKc std::cout << std::any("").type().name() << std::endl; // PKc std::cout << typeid("").name() << std::endl; // A1_c For me it looks like the first two print the type for const char* , but the last one is an array. Why do results for std::any(""