Alternate signs in a range

matovitch camille.brugel at laposte.net
Sun Jan 26 06:29:53 PST 2014


On Sunday, 26 January 2014 at 14:22:16 UTC, Stanislav Blinov 
wrote:
> On Sunday, 26 January 2014 at 13:33:58 UTC, matovitch wrote:
>> Now DMD compiler segfaulted. Here is my code if you are 
>> interested...
>>
>> struct Bernstein(alias K, int S)
>>    if (isBernstein!(K))
>> {
>>    immutable typeof(K) kernel = K;
>>    immutable int shift = S;
>> }
>>
>
> s/immutable/enum/
>
> ?

I am a *total* beginner so I am sure my code should look at least 
strange to experts. How should I write this ? Why ?

ps : It seems the compiler lost the type information when 
unpacking the tuple ?
This code doesn't compile :

template alternate(alias B)
{
     alias alternate = Bernstein!(
         array(map!(a => a[0])(zip(B.kernel, cycle([-1, 1])))),
         B.shift);
}



More information about the Digitalmars-d-learn mailing list