Bring templated base class conversion operator into derived scope

后端 未结 4 1768
旧巷少年郎
旧巷少年郎 2021-01-21 06:51

I have a base class that defines a constrained templated conversion operator

struct base {
    template 

        
4条回答
  •  抹茶落季
    2021-01-21 07:46

    I would say it is not possible. and even if it was, your derived operator would hide base one as template argument is not part according to namespace.udecl#15.sentence-1:

    When a using-declarator brings declarations from a base class into a derived class, member functions and member function templates in the derived class override and/or hide member functions and member function templates with the same name, parameter-type-list, cv-qualification, and ref-qualifier (if any) in a base class (rather than conflicting)

    Unfortunately, template parameter doesn't count and both conversion operator has empty parameter-type-list, are const and no ref-qualifier.

提交回复
热议问题