【发布时间】:2010-11-01 14:39:43
【问题描述】:
我知道可以制作模板函数:
template<typename T>
void DoSomeThing(T x){}
并且可以制作模板类:
template<typename T>
class Object
{
public:
int x;
};
但是是否可以在模板中创建一个类,然后在该类中创建一个函数作为模板?即:
//I have no idea if this is right, this is just how I think it would look
class Object
{
public:
template<class T>
void DoX(){}
};
或某种程度,类不是模板的一部分,但函数是?
【问题讨论】:
标签: c++ templates function class