Template type deduced from struct ctor?

monarch_dodra monarchdodra at gmail.com
Thu Mar 27 10:58:45 PDT 2014


On Thursday, 27 March 2014 at 17:52:34 UTC, Indigo Brown wrote:
> Or, if your constructors are simple enough, maybe something 
> like this would work
>
> struct S(alias X)
> {
>     this() { this.x = X; }
> }
>
> ...
>
> auto s = S!(x);

This is not the same, and will create a new template 
instantiation for every instance you use it with. Not recommended 
unless you know what you are doing.


More information about the Digitalmars-d mailing list