From -2967845888952977568
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,aef96954609d602c
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-08-16 17:53:52 PST
Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!math.ohio-state.edu!uwm.edu!linac!att!att!allegra!alice!ark
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.std.c++
Subject: Re: Template constraints
Message-ID: <26326@alice.att.com>
Date: 17 Aug 93 00:00:10 GMT
Article-I.D.: alice.26326
References: <744662863@amazon.cs.duke.edu> <rfgCBtK36.JMB@netcom.com> <745511175@amazon.cs.duke.edu> <rfgCBv43v.LJB@netcom.com>
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ
Lines: 41

In article <rfgCBv43v.LJB@netcom.com> rfg@netcom.com (Ronald F. Guilmette) writes:

> In article <745511175@amazon.cs.duke.edu> dsb@duke.cs.duke.edu (Scott Bigham) writes:

> >It surprises me that this surprises you.  The syntax you suggest:

> >>>>	template <class T { class M; }> void template_function (T arg)

> >looks very much like a partial class definition for T; it should come
> >as no surprise, then, that people would try to put other elements of a
> >class definition into it.

> True.  Very true.  I am not "surprized", but I am still a bit disheartened
> by this general trend (among C++ buffs) to complexify everything to the
> Nth degree.

This trend does not seem to be limited to C++ buffs.

One way of solving this problem, which I think I and several other people
have suggested independently, is something like this:

	template<class T> void template_function (T arg)
	{
		class T::M;

		// ...
	}

I think this has the advantage of requiring no really new syntax,
as well as generalizing nicely to things like

		class T::M (x);

which is already defined as equivalent to

		T::M x;

if T::M is known to be a type.
-- 
				--Andrew Koenig
				  ark@research.att.com


