下面给出的示例代码不是用g ++编译的.但它正在开发视觉工作室.是否可以在g ++中的模板类中使用模板成员函数
class Impl
{
public:
template<class I>
void Foo(I* i)
{
}
};
template<class C>
class D
{
public:
C c;
void Bar()
{
int t = 0;
c.Foo<int>(&t);
}
};
int main()
{
D<Impl> d;
d.Bar();
return 0;
}
Run Code Online (Sandbox Code Playgroud)