模板函数里能用 typeid 吗,我这崩溃了
template<typename T>void c(T*a, T*b){ if( typeid(T) == typeid(char) ) { cout<<"char type"<<endl; } else if( typeid(T) == typeid(wchar_t) ) { cout<<"wchar_t type"<<endl; }}void main(){ wchar_t*a,*b; c<wchar_t>(a,b);}template<typename T>void c(T*a, T*b){ if( typeid(T) == typeid(char) ) { cout<<"char type"<<endl; } else if( typeid(T) == typeid(wchar_t) ) { cout<<"wchar_t type"<<endl; }}int main(){ wchar_t*a=0; wchar_t*b=0; c<wchar_t>(a,b); system("pause"); return 0;}