Topic: Template Forward Declaration


Author: dirkv@netcom.com (Dirk Vermeersch)
Date: 1995/07/28
Raw View
  I have a question about templates referencing other templates:
Do template classes referenced by other templates have to be declared
before being referenced? Or do they only need to be declared when the
template is instantiated.

For example :

template <class T> class A {

int f(B<T> &);

};

template <class T> class B {

};

/*
is this valid under the standard?
I know that Borland 4.02 and g++ 2.5.8 allow this, but is this allowed under
the proposed standard?
*/

Thanks,
Dirk Vermeersch.