我有这样的代码
template <typename T> void fun (T value)
{
.....
value.print (); //Here if T is a class I want to call print (),
//otherwise use printf
.....
}
现在,要打印值,如果 T 是类,我想调用对象的打印函数,但如果 T 是基本数据类型,我只想使用 printf。
那么,如何判断 Template 类型是基本数据类型还是类呢?