2 ms·
When it comes to templates it's not until instantiation time - when the compiler see the code being used. So this is just an issue during compilation. The docs
by lumberjackstian 6y ago
When it comes to templates it's not until instantiation time - when the compiler see the code being used. So this is just an issue during compilation.
The docs on static if may shed some more light: https://dlang.org/spec/version.html#staticif https://dlang.org/spec/version.html#staticif
- RandallBrown 6y agoSo the previous code wouldn't compile unless the compiler knew what values were going to be passed into whatDoesItReturn?
- DougBTX 6y agoI missed this the first time, but there are two sets of parentheses in the example. Apparently the first set are like template parameters, and the second are the actual arguments to the function.
- lumberjackstian 6y agoAye correct! I should've been more clear about that, sorry. Template arguments need to be known at compile time, and the extra set of parens is how templates parameters are declared in D.