how to instantiate explicitly template parameters in struct A(T1){this(T2)(){...}}

Steven Schveighoffer schveiguy at yahoo.com
Mon May 13 16:12:03 PDT 2013


On Mon, 13 May 2013 19:04:39 -0400, Timothee Cour  
<thelastmammoth at gmail.com> wrote:

> Thanks!
> should that be considered as a limitation, and therefore be fixed?
> (for example by documenting the __ctor syntax)?
> The static make trick is boilerplate and shouldn't be considered the  
> best way.

Well, it's not really boilerplate :)  It takes the place of an actual  
constructor.  In other words, you don't also need a this() function.

Technically, what we are missing is the name of the constructor.   
Otherwise, you have nothing to apply the '!' to.  As I said, I don't know  
if __ctor is official, maybe it is already.  I know some code in druntime  
uses it.

-Steve


More information about the Digitalmars-d-learn mailing list