Possible Duplicate:
「Inherited」 types using CRTP and typedef爲什麼這個CRTP不能編譯?
template<typename T>
struct A {
typename T::Sub s;
};
struct B : A<B> {
struct Sub {};
};
鏘報告這種錯誤:
todo.cc:3:15: error: no type named 'Sub' in 'B'
typename T::Sub s;
~~~~~~~~~~~~^~~
todo.cc:6:12: note: in instantiation of template class 'A<B>' requested here
struct B : A<B> {
^
我怎樣才能得到這個工作?
當'B'包含的定義如何'B'從'A'繼承'A'中需要的東西? – chrisaycock 2012-07-23 17:06:24