Optional type parameter on a template

Luis luis.panadero at gmail.com
Tue May 12 21:02:24 UTC 2020


On Tuesday, 12 May 2020 at 20:40:35 UTC, Adam D. Ruppe wrote:
> A default argument of void is a common way to do it
>
> template foo(T = void) {
>    static if(is(T == void)) { not given } else { use T }
> }
>


Perfect! Works as I desired.


More information about the Digitalmars-d-learn mailing list