Template limits
Don
nospam at nospam.com
Mon May 25 05:39:12 PDT 2009
bearophile wrote:
> Max Samukha:
>> Your example can be rewritten like this: [...]<
>
> Thank you, it works.
> I have tried using result~=m; in a forward-directed for loop, but that didn't work. I think because result=m~result; creates a new array, while result~=m; tries to extend it, failing (even if with result~=m; D1 shows an error message that shows the full correct array anyway, strange).
>
> It seems you have to use subtly functional-style code in compile-time functions too.
> I'll use similar solutions in various situations.
>
> ------------------
>
> Don:
>
>> It's a bug in D1, actually. The bug was fixed in D2 but not yet in D1. As you increase the value, D1 will just silently segfault eventually. I believe D1 will be fixed in the next release.<
>
> So I'll be unable to loop a template 1000 times in D1 too?
Not sure.
>
>
>> It's bug 2569. Nothing fundamental.<
>
> It's not fundamental, but fixed-sized arrays seems a very good fit for compile-time functions. So it deserves an improvement.
No, I meant that there's no fundamental reason why it's not working,
it's just one of the many CTFE bugs. They'll all get fixed eventually.
>
> Thank you for the code and the explanations,
> bye,
> bearophile
More information about the Digitalmars-d
mailing list