Re: Templated class requires values even though having default value

2021-05-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 9 May 2021 at 10:53:49 UTC, tcak wrote: The "dim" template parameter has a default value of 1 already. Why does it still force me to give a value? It doesn't, but it does require you to instantiate the template. You can do `OpenClKernel!()` to use the default value. But without th

Templated class requires values even though having default value

2021-05-09 Thread tcak via Digitalmars-d-learn
public class OpenCLKernel(size_t dim = 1) if( (dim >= 1) && (dim <= 3) ) { public this( OpenCLProgram program, in string kernelName ) { // ... } } I have a class definition as above. When I want to create an