C++中有没有指针和对象体自由转换的结构

智能模板类之类的,可以自动切换为对象或指针~~~~~~~~~~~~~

指针加个*就表示对象了,对象加个&就转指针了,也不算那么麻烦吧。

std::string orgStr = "xxxxx";
void data = &orgStr;
std::string
msg = reinterpret_caststd::string*(data);

上面是void data,少打了个符号

reinterpret_cast被<>尖括号包围

我去,{*}星号居然要加斜杠才能打出来

目的是什么呢?指针和对象很容易转换啊