为什么以下内容不能编译?从模板化父项访问子类型定义
template <typename Child> struct Base
{
typename Child::Type t; // Does not compile. "No type named Type in Child"
};
struct Derived : public Base<Derived>
{
typedef int Type;
};
Base
如何不能访问其子类型?我尝试了静态函数而不是typedef,并且工作得很好。
我试了GCC 4.4.2和铿锵3.0。
[C++静态多态性(CRTP)和使用派生类的typedefs可能的重复](http://stackoverflow.com/questions/6006614/c-static-polymorphism-crtp-and-using-typedefs-from-derived - 班) – thirtythreeforty 2016-08-01 14:24:15