Shouldn't __traits return Tuples?

Trass3r mrmocool at gmx.de
Wed Apr 1 14:22:40 PDT 2009


Max Samukha schrieb:
> On Wed, 01 Apr 2009 20:54:12 +0200, Trass3r <mrmocool at gmx.de> wrote:
> 
>> template Sequence(size_t count, size_t index = 0)
>> {
>>    static if (index < count)
>>       alias Tuple!(index, Sequence!(count, index + 1)) Sequence;
>> }
> 
> There was ellipsis to suggest that you should terminate the recursion
> properly :) Sorry
> 
> template Sequence(size_t count, size_t index = 0)
> {
>     static if (index < count)
>        alias Tuple!(index, Sequence!(count, index + 1)) Sequence;
>    else
>        alias Tuple!() Sequence;
> }

OMG, I knew the recursion base case was missing, but I couldn't imagine 
how to represent "nothing". Of course, an empty tuple.

But the reason I posted is cause that bug(?) is still present.
dmd doesn't crash anymore, but using const still doesn't work.



More information about the Digitalmars-d mailing list