This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] float, double & complex template non-type parms
- To: Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: [C++] float, double & complex template non-type parms
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Tue, 27 Feb 2001 09:43:53 +0000
- CC: fjh at cs dot mu dot oz dot au, gcc at gcc dot gnu dot org, jason at redhat dot com, Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- Organization: Codesourcery LLC
- References: <20010227015158.A17208@hg.cs.mu.oz.au> <20010226132357A.mitchell@codesourcery.com>
Mark Mitchell wrote:
> The arguments in favor:
Another one is they're not implemented completely, for instance default
conversions (that happen for integral type template parms), don't happen
for floating ones.
template <float T> void foo () {};
template void foo<0> (); //error doesn't match
> template <class T, T t> void f(T t);
>
> is rejected as an overload candidate if `t' has type `float'. If it
It is rejected with -pedantic, accepted otherwise.
> Nathan, if you like, go ahead and prepare a deprecation patch for the
> branch, and a patch to remove them altogether on the mainline
wilco,
Wolfram Gloger wrote:
> You forgot the very important:
>
> - They enable you to write a C++ program that can compute a picture of
> the Mandelbrot set _at compile time_. With only integer arithmetic
> that is much less fun..
<chuckle> I'm sure someone skilled will find it even more fun to implement
a fixed point implementation with integral arithmetic -- after all 30 or 62
bits of binary fraction is pretty good (IIR you need 2 bits of integer for
the set) - Heck you could even do something like
template <int mantissa, int exponent> ...
probably ...
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org