2016-04-03 22 views
0

Aşağıdaki şablon kullanımıyla ilgili sorun nedir? using bildirimi?Bu şablonun kullanımıyla ilgili sorun nedir? Using` declaration

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 yakınır:

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

'kullanarak MyType = typename SOMEA :: şablon MyTemplate ;' –

+0

@PiotrSkotnicki teşekkür ederiz! Cevabınız varsa, "şablon" kelimesinin bu kullanımının gerekliliği hakkında bilgi edinebileceğim bir bağlantıyı dahil ederseniz, iyi olurdu. – AlwaysLearning

+0

Lütfen yinelenen hangisinin sorusuna bakın –

cevap

İlgili konular