Mark Mitchell <[EMAIL PROTECTED]> writes: > > ================================================== > > template <int dim> struct X { > > struct I { I(); }; > > }; > > > > template <int dim> struct Y : X<dim> { > > typedef typename X<dim>::I I; > > }; > > > > template <int dim> > > Y<dim>::I::I () {} // note: I is nested type in X, not Y! > > > > template struct Y<1>; > > ==================================================
> I forget the chapter-and-verse, but the point is that I is nested in X, > and so to *define* its constructor (as opposed to refer to it), you have > to say X<dim>::I::I(). That makes sense, but just to make sure, is this restriction limited to constructors (and presumably destructors)? That is, is this similar test case valid C++? Here the code uses Y<dim> to define a member function foo rather than defining the constructor. ================================================== template <int dim> struct X { struct I { I(); void foo(); }; }; template <int dim> struct Y : X<dim> { typedef typename X<dim>::I I; }; template <int dim> void Y<dim>::I::foo () {} template struct Y<1>; ================================================== Thanks. Ian