If the base class depends on the template parameter, its scope is not examined in the unqualified name lookup. I can use the using
declaration to introduce names from the base class. Suppose now I have a type alias template in the base class. Can the using
declaration be used to introduce it into the derived class?
template<class T>
struct Base
{
using Type1 = int;
template<typename S>
using Type2 = S;
};
template<class T>
struct Derived : Base<T>
{
using typename Base<T>::Type1; // Fine
//using Type1 = typename Base<T>::Type1; // Also fine
template<typename S>
using Type2 = typename Base<T>::template Type2<S>;
};
Can the line for Type2
be replaced with something similar to the (uncommented) line for Type1
?
Aucun commentaire:
Enregistrer un commentaire