From 3568511855407799084
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,d1b6f1d44466ce7
X-Google-Attributes: gidf78e5,public
From: "Gabor Greif" <gabor@no.netopia.com>
Subject: Re: [Q] Dependent template arguments
Date: 2000/06/30
Message-ID: <B580F2ED-A7730@192.109.102.124>#1/1
X-Deja-AN: 640532108
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <8jcs85$651$1@nnrp1.deja.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset=US-ASCII
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Newsgroups-TO: nntp://news.noris.de/comp.std.c++
X-Trace: mail2news.demon.co.uk 962309306 mail2news:22262 mail2news mail2news.demon.co.uk
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-News-Servers: news.noris.de
Mime-Version: 1.0
Newsgroups: comp.std.c++

On Thu, Jun 29, 2000 7:16 Uhr, Stephen Cleary <mailto:csclear@my-deja.com>
wrote:
>In article <B575744D-A430A@192.109.102.124>,
>  "Gabor Greif" <gabor@no.netopia.com> wrote:
>> I am evaluating what degree of dependency of template arguments is
>> permitted by the standard...
>>
>> template <typename T, template <T> class F>
>> struct foo {};
>>
>> Admittedly my example is rather contrived, but I did not find any
>hint in
>> the standard that this kind of dependency would be disallowed.
>
>Since F is a template template argument, it needs a template parameter
>list.  "<T>" is not a template parameter list.

You seem to confuse things here.

In my example F would be a template template argument of foo
and T the _kind_ of an unnamed (non-type) template argument of F.


I also could have written

template <typename T, template <T ARG> class F>
struct foo {};
(you mention this form in your reply)

but writing ARG is redundant just as parameter names in function pointer
types.

Assume I want to instantiate foo with int as the first parameter:

foo<int, TEMPLATE>();

then TEMPLATE must be a class template defined thus:

template <int I>
struct TEMPLATE {};

Hope this makes things clear.

But my original question still goes unanswered. Is the demonstrated
dependency of template arguments legal by the standard? If no, why and if
yes, are there compilers that support it?

	Gabor


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




