Default class template parameter

Igor Shirkalin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 27 12:36:53 PDT 2017


On Saturday, 27 May 2017 at 19:30:40 UTC, Stanislav Blinov wrote:
> On Saturday, 27 May 2017 at 19:23:59 UTC, Igor Shirkalin wrote:
>> [...]
>
> No, you'd have to at least write
>
> auto a = new ClassName!()(1.2);
>
> Or you could define a make function:
>
> auto makeClassName(T = double)(T value) {
>     return new ClassName!T(value);
> }
>
> auto a = makeClassName(1.2);

Thank you!


More information about the Digitalmars-d-learn mailing list