Template Class With Default Values

bauss jj_1337 at live.dk
Sun Mar 4 11:35:23 UTC 2018


Why is the following not working?

class Foo(string baz = "baz")
{
     mixin("int " ~ baz ~ ";");
}

class Bar : Foo
{
}

Shouldn't it implicit do, without me having to do it manually?

class Bar : Foo!"baz"
{
}

...

What's the reason you can't specify default values for template 
parameters on a class? Is it intended behavior or is it a bug?

https://run.dlang.io/is/tnOtn3


More information about the Digitalmars-d-learn mailing list