64,682
社区成员
发帖
与我相关
我的任务
分享
string str = typeid(vet).name();
if((int)str.find("vector")==-1)
cout<<"not vector"<<endl;
else
cout<<"is vector"<<endl;
就这样吧。template<typename T>
bool isVector(const vector<T>& v)
{
return true;
}
template<typename T>
bool isVector(const T& v)
{
return false;
}
#include <iostream>
#include <vector>
using namespace std;
void main()
{
vector<int> vet;
cout<<typeid(vet).name()<<endl;
system("pause");
}