关于调用类中的模板成员函数的语法问题,对C++模板有所研究者进
我用VC6写的小段程序
#include "stdafx.h"
#include <string>
class AAA
{
public:
template <typename T>
void f(void (*pf)(const T &aT))
{
}
};
void gg(const std::string &str)
{
}
int main(int argc, char* argv[])
{
AAA a;
a.f<std::string>(gg);//error C2275: 'std::string' : illegal use of this type as an expression
return 0;
}
对于上面编译错误不知如何解决?应该怎样正确调用类中的模板成员函数呢???