Article View: gnu.g++.bug
Article #1125Re: template <class T, T ...> important!
From: Mike Stump
Date: Tue, 10 Nov 1992 21:16
Date: Tue, 10 Nov 1992 21:16
43 lines
2212 bytes
2212 bytes
For better and worst, we will most likely follow whatever ANSI C++ says. If you really want to see different behavior from standard behavior then, I suggest you see about getting your opinions heard by the ANSI C++ committee. See comp.std.c++ for more details. > Date: Mon, 14 Sep 92 18:17:51 +0200 > From: dak@pool.informatik.rwth-aachen.de (David Kastrup) > Message-Id: <9209141617.AA01219@messua> > To: bug-g++@prep.ai.mit.edu > There was some discussion going on whether the above construction > was legal. > Although it is not explicitly stated in ARM, it is a very important > construction, because: > Templates cannot be nested. Suppose you have a sort template that > should work as fast as possible on linked lists. It would look something > like: > template <class T, T * T::*link> > You could modify the link parameter to be a parameter for the > subroutine, but then you are replacing a compile time constant > by a variable which would usually assume one value anyhow. > Consider defining a Fourier transform working on arbitrary fields > with roots of 1. > Then you could use something like > template <class Field, unsigned N, Field * Nthroot> > and use it something like > Complex const NR = exp(2*pi*Complex(0,1)/N); > fft<Complex, 1024, &NR>.transform(... > or > Modular<64513> NR = 9; //Value is wrong > fft<Modular<64513>, 1024, &NR>.transform(... > Although it would work with complex numbers just as fast as usual, > it would without modification work even faster with other fields > as a base. > Other classes and functions might need other information > necessarily not included in the basic type, but being constant. > PLEASE let the template scopes begin immediately after their declaration, > not after the closing >.
Technical Details
Message-ID:
<9211102116.AA26275@cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrsShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs From: mrs@cygnus.com (Mike Stump) Subject: Re: template <class T, T ...> important! Message-ID: <9211102116.AA26275@cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 10 Nov 1992 21:16:08 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 44