Are members of a nested class be members of the enclosing class?

Viewed 98

Consider the example that follows [temp.dep.type] p3

template<class T> struct A {
  typedef int M;
  struct B {
    typedef void M;
    struct C;
  };
};

template<class T> struct A<T>::B::C : A<T> {
  M m;                          // OK, A<T>​::​M
};

The example implies that A is a current instantiation class in the definition of A::B::C. However, according to [temp.dep.type#1.2]

A name or template-id refers to the current instantiation if it is

  • [...]
  • in the definition of a primary class template or a member of a primary class template, the name of the class template followed by the template argument list of its template-head ([temp.arg]) enclosed in <> (or an equivalent template alias specialization),
  • [...]

In this example, the primary class template is A, Is that saying the member class C of the nested class B is a member of class template A?

0 Answers
Related