|
|
|
|
|
by gallier2
2245 days ago
|
|
No. It is known at compile time. Template declarations in D take 2 parameter lists. The first is the template parameters the second the runtime parameter:
in
auto whatDoesItReturn(int i)() { static if (i == 0) { return int.init; } else { return string.init; } } we have (int i) as template parameter and () as an empty runtime parameter. In C++ syntax whatDoesItReturn<int i>() at instanciation the syntax is different: whatDoesItReturn!0() will instantiate a function returning an int whatDoesItReturn!42() will instantiate a function returning a string. |
|