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

Timon Gehr timon.gehr at gmx.ch
Mon May 13 16:25:46 PDT 2013


On 05/14/2013 01:25 AM, Timon Gehr wrote:
> On 05/13/2013 10:27 PM, Timothee Cour wrote:
>> While writing DIP40, I came upon the following question:
>> how to instantiate explicitly template parameters for both the
>> class/struct AND the constructor?
>> for example: struct A(T1){this(T2)(){...}}  ? (T2 could be used
>> somehow inside the ctor body for example)
>> // auto a=A!double!int(); // CT error
>> The example is a bit contrived but there could be less contrived ones
>> where both A and ctor need explicit instantiations.
>>
>
> There is a more basic question:
> How to explicitly pass template arguments to _any_ constructor?

(There currently is no documented way.)


More information about the Digitalmars-d-learn mailing list