64,654
社区成员
发帖
与我相关
我的任务
分享
class ClassA
{
};
template < typename T > class TemplateTest
{
public:
static bool getStatus(int i){
return mapint.find(i)==mapint.end()?true:false;
}
static std::set<int> mapint;
};
void TestT()
{
bool b = TemplateTest<ClassA>::getStatus(0);
}
std::set<int> TemplateTest::mapint;
而不应该是static std::set<int> TemplateTest::mapint;
class ClassA
{
};
template < typename T > class TemplateTest
{
public:
static bool getStatus(int i){
return GetMapint().find(i)==GetMapint().end()?true:false;
}
static std::set<int> &GetMapint()
{
static std::set<int> mapint;
return mapint;
}
};
void TestT()
{
bool b = TemplateTest<ClassA>::getStatus(0);
}
稍后结贴