我知道可以制作模板功能:
template<typename T>
void DoSomeThing(T x){}
Run Code Online (Sandbox Code Playgroud)
并且可以创建模板类:
template<typename T>
class Object
{
public:
int x;
};
Run Code Online (Sandbox Code Playgroud)
但是可以创建一个不在模板中的类,然后在该类中创建一个模板的函数吗?即:
//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(){}
};
Run Code Online (Sandbox Code Playgroud)
或类似的程度,类不是模板的一部分,但功能是?