From -4704397352987278001
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,94948bbb031f36b
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-09-23 09:22:47 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: kuyper@wizard.net ("James Russell Kuyper Jr.")
Newsgroups: comp.std.c++
Subject: Re: how to define a template function with a templatized parameter
Date: Mon, 23 Sep 2002 16:22:47 +0000 (UTC)
Organization: Not Enough
Lines: 38
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3D8EF2C5.20BC0EAB@wizard.net>
References: <3D8D2E06.9D30B9D@optech.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1032798167 29240 10.0.0.1 (23 Sep 2002 16:22:47 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 23 Sep 2002 16:22:47 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 17tVyv-0007aM-00
	for mail2news@news.news.demon.net; Mon, 23 Sep 2002 16:22:46 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id CAA06097; Tue, 24 Sep 2002 02:19:13 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Accept-Language: en, es, de, ru
X-Newsgroups: comp.std.c++
X-GC-Trace: gv1-PclqvVTzSVxd8715av/sLOY8oL/MP1q+1V8t40oxfAl50XMNkg=
X-NNTP-Posting-Date: Mon, 23 Sep 2002 05:53:38 CDT
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.1
Xref: archiver1.google.com comp.std.c++:14136

john wrote:
> 
> Can someone tell if it is possible and if so how to declare a template
> function that has a template
> parameter that is an instance of a template class. I would like to
> create a function that would
> take a container class and a type as specified template types. Whether
> this is is efficient, good
> form, impractical or not I am not concerned. I am just interested in
> whether it can be done and
> if so how.
> 
> I tried something simple like
> 
> template <class C, class T> void foo( C<T> & cont);

That syntax recognises C only as a class, not as a template, so C<T>
isn't legal syntax.

> or
> template < template<class T> class C> > void foo ( C<T>& cont);

The problem with that syntax is that the T isn't itself a template
parameter; it's purely a place holder, like the 'd' in the following
declaration:

	void bar(void (*f)(double d) );

Try this instead:

template < template<class> class C, class T> void foo(C<T> & const);

---
[ 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://www.jamesd.demon.co.uk/csc/faq.html                       ]



