Using declaration for type alias template in derived class with tempate base

谁都会走 提交于 2020-01-14 07:46:09

问题


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?

来源:https://stackoverflow.com/questions/42445594/using-declaration-for-type-alias-template-in-derived-class-with-tempate-base

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!