开发者

IPhone compilation of ported code problems: calling a static templated function that's inside a templated class == fail

template<typename T> struct AClass
{
public:
 开发者_Go百科    template<typename T0>
     static void AFunc()
     {}
};

template<typename T>
void ATestFunc()
{
     AClass<T>::AFunc<int>();
}

this works on other platforms, but not on the iPhone I get an error " expected primary-expression before 'int' " on the line where I call the function.

it works fine if I was to do

AClass<int>::AFunc<int>();

and it works fine if we ditch the template parameter for the function as well:

template<typename T> struct AClass
{
public:

     static void AFunc()
     {}
};

template<typename T>
void ATestFunc()
{
     AClass<T>::AFunc();
}

Any Ideas as to why it doesn't work with the iPhone?


try changing the line AClass<T>::AFunc<int>() to AClass<T>::template AFunc<int>();

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜