开发者

tempate function into a non-templated class?

I would like to add a "templated function" into a non-templated function like this :

class A
{
template <class T>
void Test<T>();
}

template <class T>
A::Test<T>();

But it tell me that I have an error in开发者_JAVA技巧 the .h file ! Is there a problem with this declaration ?

Remarks : my class MUST not be templated !

Thanks


You can define a member function template as follows:

class A
{
    template <typename T>
    void Test()
    {
        ...
    };
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜