1
template <class Derived>
struct Base {
typedef typename Derived::T T;
};
template <typename T_>
struct Impl : public Base<Impl<T_>> {
typedef T_ T;
};
이 초기화 때, 나는 'IMPL'그래서기본 클래스에서 파생 된 typename을 얻는 방법은 무엇입니까?
, 어떻게 얻을 수있는 유형 이름에 'T'라는 이름
어떤 유형의 오류가 기본 클래스에서 파생 된 정의있어?
[템플릿 및 "typename"키워드를 어디에 왜 넣어야합니까?] (https://stackoverflow.com/questions/610245/where-and-why-do-i-have -to-put-the-template-and-typename-keywords) – user0042
'typename'키워드 자체에 관한 것이 아니라 typename 가시성에 관한 것입니다. –
필자는 일종의 원형 정의라고 말할 것입니다. Impl에서 T를 두 번 정의하면,'struct Impl : public Base {'? –
nsubiron