Re: Variable "i" can not be read at compile time

2020-05-24 Thread ag0aep6g via Digitalmars-d-learn
On 24.05.20 19:13, data pulverizer wrote: Thank you very much. I though that if I used a `static foreach` loop D would attempt to run the calculation `bench()` at compile time rather than at run time but it doesn't which is good. So `static foreach` allows you to index at compile time and if

Re: Variable "i" can not be read at compile time

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 17:13:23 UTC, data pulverizer wrote: On Sunday, 24 May 2020 at 16:57:54 UTC, ag0aep6g wrote: On 24.05.20 18:34, data pulverizer wrote: Since `kernel` is a `Tuple`, you can only access it with compile-time constant indices. But your loop variable `i` is not a

Re: Variable "i" can not be read at compile time

2020-05-24 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 24 May 2020 at 16:57:54 UTC, ag0aep6g wrote: On 24.05.20 18:34, data pulverizer wrote: Since `kernel` is a `Tuple`, you can only access it with compile-time constant indices. But your loop variable `i` is not a compile-time constant, it's being calculated at run time. What's more,

Re: Variable "i" can not be read at compile time

2020-05-24 Thread ag0aep6g via Digitalmars-d-learn
On 24.05.20 18:34, data pulverizer wrote: I'm getting the error: ``` Error: variable i cannot be read at compile time Error: template instance script.runKernelBenchmarks!(Tuple!(DotProduct!float, Gaussian!float, Polynomial!float, Exponential!float, Log!float, Cauchy!float, Power!float,

Variable "i" can not be read at compile time

2020-05-24 Thread data pulverizer via Digitalmars-d-learn
Hi all, I'm getting the error: ``` Error: variable i cannot be read at compile time Error: template instance script.runKernelBenchmarks!(Tuple!(DotProduct!float, Gaussian!float, Polynomial!float, Exponential!float, Log!float, Cauchy!float, Power!float, Wave!float, Sigmoid!float)) error