如果模板参数是值还是类型,是否可以使用特征来推断?
template <typename A>
void function(){
if(is_value<A>()::value)
cout<<"A is value"<<endl;
else
cout<<"A is type"<<endl;
}
int main(){
function<int>();
function<3>();
}
输出
"A is type"
"A is value"