inner templates?
dennis luehring
dl.soluz at gmx.net
Thu May 24 14:29:08 PDT 2007
hi
i've try to write an template wich calculates e
ok here it is - but wait i need a helper template to reduce the
interface to my needs (just to adjust the precision) - is there any way
getting rid of these helper template (maybe an inner-template or something)?
--
import std.stdio;
template e_help(double p, double s, double f, int n)
{
static if( s > p )
const e_help = e_help!(p, s/n,f+s/n,n+1);
else
const e_help = f;
}
// this is the interface i want - but without the e_help template
template e(double p = 1e-14)
{
const e = e_help!(p, 1, 1, 1);
}
void main()
{
writefln("e: ", e!());
}
--
ciao dennis
More information about the Digitalmars-d
mailing list