typedef是一个专门的嵌套模板 我试图编译一些不再有效的C++ C++代码(VS2008到VS2015)。我设法把问题缩小到像这样的范围 class Any { }; class Parent { template < typename anyT> class Child { }; }; template< typename parentT > class Fail { typedef typename parentT::Child<Any> ChildT; // 2 errors typename ChildT _child; // 2 errors }; classany{}; 班级家长 { 模板 类子{}; }; 模板 班级不及格 { typedef typename parentT::Child Child;//2个错误 typename child _child;//2个错误 };
我从Visual Studio 2015获得此编译器错误typedef是一个专门的嵌套模板 我试图编译一些不再有效的C++ C++代码(VS2008到VS2015)。我设法把问题缩小到像这样的范围 class Any { }; class Parent { template < typename anyT> class Child { }; }; template< typename parentT > class Fail { typedef typename parentT::Child<Any> ChildT; // 2 errors typename ChildT _child; // 2 errors }; classany{}; 班级家长 { 模板 类子{}; }; 模板 班级不及格 { typedef typename parentT::Child Child;//2个错误 typename child _child;//2个错误 };,c++,templates,nested,typedef,C++,Templates,Nested,Typedef,我从Visual Studio 2015获得此编译器错误 Error C2059 syntax error: '<' TemplateTest d:\programming\templatetest\example.h 12 Error C2238 unexpected token(s) preceding ';' TemplateTest d:\programming\templatetest\example.h 12 Error C364
Error C2059 syntax error: '<' TemplateTest d:\programming\templatetest\example.h 12
Error C2238 unexpected token(s) preceding ';' TemplateTest d:\programming\templatetest\example.h 12
Error C3646 '_child': unknown override specifier TemplateTest d:\programming\templatetest\example.h 13
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int TemplateTest d:\programming\templatetest\example.h 13
错误C2059语法错误:'
typedef typename parentT::template Child Child;
儿童(child),;
typedef typename parentT::template Child Child;
儿童(child),;
typedef typename parentT::template Child<Any> ChildT;
ChildT _child;