Passing variadic template parameters AND default call site __FILE__, __LINE__ template parameters.
realhet
real_het at hotmail.com
Tue May 27 10:20:40 UTC 2025
Hello,
```d
template T1(string FILE=__FILE__, size_t LINE=__LINE__, A...)
{
enum T1 = FILE ~ LINE.text ~ A.text;
}
pragma(msg, T1!(__FILE__,__LINE__, "hello", " world")); //works
pragma(msg, T1!(__FILE__,__LINE__,i"Hello $("World")")); //works
pragma(msg, T1!(i"Hello $("World")")); //error: does not match
template declaration `T1(string FILE = __FILE__, ulong LINE =
__LINE__, A...)`
```
After "A..." I can't put anything, so it seems it is impossible
to combine the two superpowers: call site evaluation and variadic
template parameters.
I can do similar functionality by function evaluation, but not
with template instantiation.
Is there a way to do this functionality?
More information about the Digitalmars-d-learn
mailing list