mardi 25 février 2020

Overloading type from parent namespace

This seems to compile correctly:

namespace A {
    template<typename T>
    struct S {};

    namespace B {
        using S = S<int>;
    }
}

int main() {
    using namespace A::B;
    S s;
}

Even though at the line using S = S<int>, the first S refers to A::B::S, whereas the second S refers to the template A::S.

Is this standard C++?

Aucun commentaire:

Enregistrer un commentaire