Reducing variadic template combinatorics (C++ was onto something)
Dennis
dkorpel at gmail.com
Tue Oct 14 15:35:48 UTC 2025
On Tuesday, 14 October 2025 at 14:44:56 UTC, Steven Schveighoffer
wrote:
> Right, if nothing else it is a "best practice" on how to avoid
> template bloat. But if there is a way we can convey to the
> compiler this pattern, it would be very nice!
I don't see the difference between the two, isn't the following
both a "best practice" as well as conveying the pattern to the
compiler?
```D
void f(T...)(T args) if (T.length > 1)
{
foreach (arg; args)
f(arg);
}
void f(T)(T arg)
{
// Implementation
}
```
More information about the Digitalmars-d
mailing list