Is instantiabilty of templated types decidable?
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Sun Nov 11 12:40:32 PST 2012
On Sun, 11 Nov 2012 19:37:45 +0100
Timon Gehr <timon.gehr at gmx.ch> wrote:
> On 11/11/2012 03:45 PM, Peter Alexander wrote:
> >
> > Collatz sequence.
> >
> > struct Collatz(int n)
> > {
> > enum next = n % 2 == 0 ? n / 2 : 3 * n + 1;
> > Collatz!(next)* foo;
> > }
> >
> > It's an unsolved problem in mathematics whether or not this
> > instantiates an infinite number of templates.
>
> The possible inputs are finite, so the property is decidable.
Technically, yea, but I think upwards of ~4 billion template
instantiations is quite unrealistic, to the point of being effectively
undecidable.
More information about the Digitalmars-d
mailing list