请注意,我可以简单地绕过这个问题,我只是好奇为什么会发生这种情况.
我试图在另一个模板化函数的返回值上调用模板化函数,所有函数都在模板化函数中.我用模板化对象作为模板参数调用模板化函数.模板化对象使用外部模板参数定义.
#include <string>
class Class
{
public:
static Class& define( std::string name ) {
return *new Class();
}
template<typename C, typename... Args>
Class& constructor() {
// .. Add the constructor...
return *this;
}
};
template<typename T>
class iVector {
T x; T y;
iVector() : x( 0 ), y( 0 ) {}
iVector( T x, T y ) : x( x ), y( y ) {}
};
typedef iVector<int> Vector;
Class& registerVector( std::string name ) {
// This works …Run Code Online (Sandbox Code Playgroud)