2016-04-03 7 views
0

テンプレートusing宣言の次の使い方に何が問題になっていますか?テンプレートの `using`宣言のこの使用で何が問題になっています

template <typename T1, typename T2> struct A { 
    template <typename AnotherT1> 
    using MyTemplate = A<AnotherT1, T2>; 
}; 

template<class SomeA> struct B { 
    using MyType = typename SomeA::MyTemplate<double>; 
}; 

int main() { 
    B<A<int, int>> b; (void)b; 
} 

gcc 4.8.2文句:

temp.cpp:17:46: error: expected ‘;’ before ‘<’ token 
    using MyType = typename SomeA::MyTemplate<double>; 
              ^
temp.cpp:17:46: error: expected unqualified-id before ‘<’ token 
temp.cpp: In instantiation of ‘struct B<A<int, int> >’: 
temp.cpp:21:20: required from here 
temp.cpp:17:46: error: ‘typename A<int, int>::MyTemplate’ names ‘template<class AnotherT1> using MyTemplate = struct A<AnotherT1, int>’, which is not a type 
+2

';' –

+0

@PiotrSkotnickiありがとうございます!あなたがそれを返事にすることができればうれしいです。ここでは、「テンプレート」という言葉のこの使用法の必要性について学ぶことができるリンクをご好意的に含めることになります。 – AlwaysLearning

+0

あなたの重複している質問を参照してください –

答えて

関連する問題