Topic: C++ should require class template predeclarations!


Author: rickh@teal.csn.org (Rick Hollinbeck)
Date: Fri, 31 Dec 1993 22:43:12 GMT
Raw View
To: rickh@csn.org (Rick Hollinbeck)
Subject: Re: Can undeclared class templates be used?
Newsgroups: comp.std.c++
Organization: Colorado SuperNet, Inc.

In article <CIp4wF.3Kx@csn.org> you wrote:
Hmmm... somehow the text to my previous message was lost!
Maybe it was pulled over for ambiguity on the information highway.

I was wondering whether the ANSI committee is planning on tightening up
class template syntax by requiring forward declarations of class
templates, just as classes must be forward declared before being used as a
type name.
The ARM says that undeclared class templates can be used, even without
a forward declaration. In fact, Borland C++ v3.1 seems to allow this
"feature".
This leads to incongruity with the use of normal C++ class names, which
must be predeclared.
It also leads to several unnecessary language ambiguities in expressions
like: A<B>::C if A,B and C are not predeclared type or template names.
Preceding this with a template<class T> class A; declaration clears up the
ambiguity and makes C++ a more consistent language.
Any reason for NOT requiring declarations of template classes?