any_cast std::any pointer to specific pointer type
问题 I would like std::map<string, any> *var1 to point to the same memory address/value as std::any *var2 because I know that var2 is pointing to a map<string, any> . The following seems to work: std::map<string, any> *var1 = any_cast<std::map<string, any>>(var2); Is it ok? The problem is that it does not signal bad cast even if var2 is actually not an std::map<string, any>* but something else, but if it is it still works. Am I doing it right? std::map<string, any> *mapptr; std::any realmap = std: