我有 3 个或更多 struct ,我希望我有一个函数来打印任何结构
例如 :
struct A
{
int a0;
string a1;
bool a2;
}
Run Code Online (Sandbox Code Playgroud)
和
struct B
{
CString b0;
double b1;
int b2;
string b3
}
Run Code Online (Sandbox Code Playgroud)
我想用相同的功能打印这个结构(A 和 B)
像这样 :
template<typename T>
inline void print(T)
{
std::cout << // I don't know what is write here....
}
Run Code Online (Sandbox Code Playgroud)
任何机构帮助我?